SaslServer

SaslServer (SASL 서버)

서버로서 SASL 인증을 수행하는 인터페이스입니다.

출처: Java API Reference

본문

LDAP 서버 같은 서버는 특정 SASL 메커니즘으로 정의된 인증을 수행하기 위해 이 클래스의 인스턴스를 얻습니다. SaslServer 인스턴스의 메서드를 호출하면 SaslServer가 구현한 SASL 메커니즘에 따라 챌린지를 생성해요. 인증이 진행됨에 따라 인스턴스는 SASL 서버의 인증 교환 상태를 캡슐화합니다.

LDAP 서버가 SaslServer를 사용하는 예는 다음과 같습니다.

SaslServer ss = Sasl.createSaslServer(mechanism, "ldap", myFQDN, props, callbackHandler);
while (!ss.isComplete()) {
    try {
        byte[] challenge = ss.evaluateResponse(response);
        if (ss.isComplete()) {
            status = ldap.sendBindResponse(mechanism, challenge, SUCCESS);
        } else {
            status = ldap.sendBindResponse(mechanism, challenge, SASL_BIND_IN_PROGRESS);
            response = ldap.readBindRequest();
        }
    } catch (SaslException e) {
        status = ldap.sendErrorResponse(e);
        break;
    }
}

인증이 완료되고 협상된 QOP가 "auth-int""auth-conf"라면 서버와 클라이언트 사이의 이후 통신에 wrapunwrap을 사용해 보호를 적용할 수 있어요.

String getMechanismName()
byte[] evaluateResponse(byte[] response) throws SaslException
boolean isComplete()
String getAuthorizationID()
byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException
byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException
Object getNegotiatedProperty(String propName)
void dispose() throws SaslException

getAuthorizationID()는 인증 완료 후 실제 작업을 수행할 권한이 부여된 사용자의 id를 반환합니다.

더 알아보기 (Learn more)

Java 공식 API