Example usage for javax.security.sasl SaslServer SaslServer

List of usage examples for javax.security.sasl SaslServer SaslServer

Introduction

In this page you can find the example usage for javax.security.sasl SaslServer SaslServer.

Prototype

SaslServer

Source Link

Usage

From source file:org.wso2.andes.server.security.auth.manager.PrincipalDatabaseAuthenticationManagerTest.java

/**
 * Test SASL implementation used to test the authenticate() method.
 *///from  w w w .j a va 2 s  .  c om
private SaslServer createTestSaslServer(final boolean complete, final boolean throwSaslException) {
    return new SaslServer() {
        public String getMechanismName() {
            return null;
        }

        public byte[] evaluateResponse(byte[] response) throws SaslException {
            if (throwSaslException) {
                throw new SaslException("Mocked exception");
            }
            return null;
        }

        public boolean isComplete() {
            return complete;
        }

        public String getAuthorizationID() {
            return complete ? "guest" : null;
        }

        public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException {
            return null;
        }

        public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
            return null;
        }

        public Object getNegotiatedProperty(String propName) {
            return null;
        }

        public void dispose() throws SaslException {
        }
    };
}