Search in sources :

Example 1 with WhiteboardCallback

use of org.apache.jackrabbit.oak.spi.security.authentication.callback.WhiteboardCallback in project jackrabbit-oak by apache.

the class CallbackHandlerImplTest method handleWhiteboardCallback.

@Test
public void handleWhiteboardCallback() throws Exception {
    WhiteboardCallback cb = new WhiteboardCallback();
    callbackHandler.handle(new Callback[] { cb });
    assertSame(whiteboard, cb.getWhiteboard());
}
Also used : WhiteboardCallback(org.apache.jackrabbit.oak.spi.security.authentication.callback.WhiteboardCallback) AbstractSecurityTest(org.apache.jackrabbit.oak.AbstractSecurityTest) Test(org.junit.Test)

Example 2 with WhiteboardCallback

use of org.apache.jackrabbit.oak.spi.security.authentication.callback.WhiteboardCallback in project jackrabbit-oak by apache.

the class AbstractLoginModule method getWhiteboard.

/**
     * Tries to obtain the {@code Whiteboard} object from the callback
     * handler using a new WhiteboardCallback and keeps the value as
     * private field. If the callback handler isn't able to handle the
     * WhiteboardCallback this method returns {@code null}.
     *
     * @return The {@code Whiteboard} associated with this
     *         {@code LoginModule} or {@code null}.
     */
@CheckForNull
protected Whiteboard getWhiteboard() {
    if (whiteboard == null && callbackHandler != null) {
        WhiteboardCallback cb = new WhiteboardCallback();
        try {
            callbackHandler.handle(new Callback[] { cb });
            whiteboard = cb.getWhiteboard();
        } catch (Exception e) {
            log.debug("Unable to retrieve the Whiteboard via callback", e);
        }
    }
    return whiteboard;
}
Also used : WhiteboardCallback(org.apache.jackrabbit.oak.spi.security.authentication.callback.WhiteboardCallback) LoginException(javax.security.auth.login.LoginException) UnsupportedCallbackException(javax.security.auth.callback.UnsupportedCallbackException) NoSuchWorkspaceException(javax.jcr.NoSuchWorkspaceException) PrivilegedActionException(java.security.PrivilegedActionException) IOException(java.io.IOException) CheckForNull(javax.annotation.CheckForNull)

Aggregations

WhiteboardCallback (org.apache.jackrabbit.oak.spi.security.authentication.callback.WhiteboardCallback)2 IOException (java.io.IOException)1 PrivilegedActionException (java.security.PrivilegedActionException)1 CheckForNull (javax.annotation.CheckForNull)1 NoSuchWorkspaceException (javax.jcr.NoSuchWorkspaceException)1 UnsupportedCallbackException (javax.security.auth.callback.UnsupportedCallbackException)1 LoginException (javax.security.auth.login.LoginException)1 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)1 Test (org.junit.Test)1