| | |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.ResultCode; |
| | | |
| | | import static org.opends.server.loggers.Debug.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.messages.ExtensionsMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | public class GSSAPIStateInfo |
| | | implements PrivilegedExceptionAction<Boolean>, CallbackHandler |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.GSSAPIStateInfo"; |
| | | |
| | | |
| | | |
| | |
| | | BindOperation bindOperation, String serverFQDN) |
| | | throws InitializationException |
| | | { |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(bindOperation), |
| | | String.valueOf(serverFQDN)); |
| | | |
| | | this.gssapiHandler = gssapiHandler; |
| | | this.bindOperation = bindOperation; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "<init>", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_SASLGSSAPI_CANNOT_CREATE_LOGIN_CONTEXT; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "<init>", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_SASLGSSAPI_CANNOT_AUTHENTICATE_SERVER; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | |
| | | */ |
| | | public void setBindOperation(BindOperation bindOperation) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setBindOperation", |
| | | String.valueOf(bindOperation)); |
| | | |
| | | this.bindOperation = bindOperation; |
| | | } |
| | |
| | | */ |
| | | public Entry getUserEntry() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getUserEntry"); |
| | | |
| | | return userEntry; |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "dispose", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public void processAuthenticationStage() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "processAuthenticationStage"); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "processAuthenticationStage", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public Boolean run() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "run"); |
| | | |
| | | |
| | | if (saslServer == null) |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "run", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_SASLGSSAPI_CANNOT_CREATE_SASL_SERVER; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "run", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | catch (Exception e2) |
| | | { |
| | | assert debugException(CLASS_NAME, "run", e2); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e2); |
| | | } |
| | | } |
| | | |
| | | int msgID = MSGID_SASLGSSAPI_CANNOT_EVALUATE_RESPONSE; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "run", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | |
| | | int msgID = MSGID_SASLGSSAPI_NO_AUTHZ_ID; |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "run", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "run", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | |
| | | bindOperation.setResultCode(ResultCode.INVALID_CREDENTIALS); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "run", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | |
| | | int msgID = MSGID_SASLGSSAPI_CANNOT_MAP_AUTHZID; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "run", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | |
| | | return true; |
| | |
| | | public void handle(Callback[] callbacks) |
| | | throws UnsupportedCallbackException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "handle", String.valueOf(callbacks)); |
| | | |
| | | |
| | | for (Callback callback : callbacks) |