@Test public void invalidRole() { final KarafJaasAuthenticator authenticator = new KarafJaasAuthenticator("karaf", "test", new Class<?>[]{RolePrincipal.class}); assertFalse(authenticator.authenticate("customRole", "test", session)); }
public boolean authenticate(final String username, final String password, final ServerSession session) { CallbackHandler callbackHandler = callbacks -> { for (Callback callback : callbacks) { if (callback instanceof NameCallback) { ((NameCallback) callback).setName(username); } else if (callback instanceof PasswordCallback) { ((PasswordCallback) callback).setPassword(password.toCharArray()); } else { throw new UnsupportedCallbackException(callback); } } }; return doLogin(session, callbackHandler); }
KarafJaasAuthenticator implements PasswordAuthenticator, PublickeyAuthenticator { public boolean authenticate(final String username, final String password, final ServerSession session) { CallbackHandler callbackHandler = callbacks -> { for (Callback callback : callbacks) { if (callback instanceof NameCallback) { ((NameCallback) callback).setName(username); } else if (callback instanceof PasswordCallback) { ((PasswordCallback) callback).setPassword(password.toCharArray()); } else { throw new UnsupportedCallbackException(callback); } } }; return doLogin(session, callbackHandler); } }
KarafJaasAuthenticator implements PasswordAuthenticator, PublickeyAuthenticator { public boolean authenticate(final String username, final String password, final ServerSession session) { CallbackHandler callbackHandler = callbacks -> { for (Callback callback : callbacks) { if (callback instanceof NameCallback) { ((NameCallback) callback).setName(username); } else if (callback instanceof PasswordCallback) { ((PasswordCallback) callback).setPassword(password.toCharArray()); } else { throw new UnsupportedCallbackException(callback); } } }; return doLogin(session, callbackHandler); } KarafJaasAuthenticator(String realm, String role, Class<?>[] roleClasses); }
KarafJaasAuthenticator implements PasswordAuthenticator, PublickeyAuthenticator { public boolean authenticate(final String username, final String password, final ServerSession session) { CallbackHandler callbackHandler = callbacks -> { for (Callback callback : callbacks) { if (callback instanceof NameCallback) { ((NameCallback) callback).setName(username); } else if (callback instanceof PasswordCallback) { ((PasswordCallback) callback).setPassword(password.toCharArray()); } else { throw new UnsupportedCallbackException(callback); } } }; return doLogin(session, callbackHandler); } KarafJaasAuthenticator(String realm, String role, Class<?>[] roleClasses); boolean authenticate(final String username, final String password, final ServerSession session); boolean authenticate(final String username, final PublicKey key, final ServerSession session); }
KarafJaasAuthenticator implements PasswordAuthenticator, PublickeyAuthenticator { public boolean authenticate(final String username, final String password, final ServerSession session) { CallbackHandler callbackHandler = callbacks -> { for (Callback callback : callbacks) { if (callback instanceof NameCallback) { ((NameCallback) callback).setName(username); } else if (callback instanceof PasswordCallback) { ((PasswordCallback) callback).setPassword(password.toCharArray()); } else { throw new UnsupportedCallbackException(callback); } } }; return doLogin(session, callbackHandler); } KarafJaasAuthenticator(String realm, String role, Class<?>[] roleClasses); boolean authenticate(final String username, final String password, final ServerSession session); boolean authenticate(final String username, final PublicKey key, final ServerSession session); static final Session.AttributeKey<Subject> SUBJECT_ATTRIBUTE_KEY; }