cbh.handle(new Callback[]{ nc, pc, ac }); if (ac.isAuthorized()) { authz = ac.getAuthorizedID();
throw new SaslException("AuthorizeCallback authorized failure"); mAuthorizationId = authCallback.getAuthorizedID(); } catch (Exception e) { throw new SaslException("Plain authentication failed: " + e.getMessage(), e);
mImpersonationAuthenticator.authenticate(username, ac.getAuthorizedID()); } catch (Exception e) { ac.setAuthorized(false); AuthenticatedClientUser.set(ac.getAuthorizedID());
cbh.handle(new Callback[]{nc, pc, ac}); if (ac.isAuthorized()) { authz = ac.getAuthorizedID();
private static void log(String type, AuthorizeCallback ac, NameCallback nc, PasswordCallback pc, RealmCallback rc) { if (LOG.isDebugEnabled()) { String acs = "null"; if (ac != null) { acs = "athz: " + ac.getAuthorizationID() + " athn: " + ac.getAuthenticationID() + " authorized: " + ac.getAuthorizedID(); } String ncs = "null"; if (nc != null) { ncs = "default: " + nc.getDefaultName() + " name: " + nc.getName(); } String pcs = "null"; if (pc != null) { char[] pwd = pc.getPassword(); pcs = "password: " + (pwd == null ? "null" : "not null " + pwd.length); } String rcs = "null"; if (rc != null) { rcs = "default: " + rc.getDefaultText() + " text: " + rc.getText(); } LOG.debug("{}\nAC: {}\nNC: {}\nPC: {}\nRC: {}", type, acs, ncs, pcs, rcs); } }
cbh.handle(new Callback[]{acb}); if(acb.isAuthorized()) { username = acb.getAuthorizedID(); completed = true; } else {
authorizationId = authorizeCallback.getAuthorizedID(); } else { throw saslDigest.mechAuthorizationFailed(username, authzid).toSaslException();
public byte[] evaluateResponse(final byte[] response) throws SaslException { if (complete) { throw saslExternal.mechMessageAfterComplete().toSaslException(); } complete = true; String authorizationId; if (response.length == 0) { authorizationId = null; } else { authorizationId = Normalizer.normalize(new String(response, StandardCharsets.UTF_8), Normalizer.Form.NFKC); if (authorizationId.indexOf(0) != -1) { throw saslExternal.mechUserNameContainsInvalidCharacter().toSaslException(); } } final AuthorizeCallback authorizeCallback = new AuthorizeCallback(null, authorizationId); try { cbh.handle(Arrays2.of(authorizeCallback)); } catch (SaslException e) { throw e; } catch (IOException e) { throw saslExternal.mechAuthorizationFailed(e).toSaslException(); } catch (UnsupportedCallbackException e) { throw saslExternal.mechAuthorizationFailed(e).toSaslException(); } if (!authorizeCallback.isAuthorized()) { throw saslExternal.mechAuthorizationFailed(null, authorizationId).toSaslException(); } this.authorizationID = authorizeCallback.getAuthorizedID(); return null; }
authorizedId = acb.getAuthorizedID(); } else { throw saslPlain.mechAuthorizationFailed(loginName, authorizationId).toSaslException();
cbh.handle(new Callback[]{nc, pc, ac}); if (ac.isAuthorized()) { authz = ac.getAuthorizedID();
cbh.handle(new Callback[]{nc, pc, ac}); if (ac.isAuthorized()) { authz = ac.getAuthorizedID();
cbh.handle(new Callback[]{nc, pc, ac}); if (ac.isAuthorized()) { authz = ac.getAuthorizedID();
cbh.handle(new Callback[]{nc, pc, ac}); if (ac.isAuthorized()) { authz = ac.getAuthorizedID();
cbh.handle(new Callback[]{nc, pc, ac}); if (ac.isAuthorized()) { authz = ac.getAuthorizedID();
mImpersonationAuthenticator.authenticate(username, ac.getAuthorizedID()); } catch (Exception e) { ac.setAuthorized(false); AuthenticatedClientUser.set(ac.getAuthorizedID());
public byte[] evaluateResponse(final byte[] response) throws SaslException { if (complete.getAndSet(true)) { throw new SaslException("Received response after complete"); } String userName; try { userName = new String(response, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new SaslException("Cannot convert user name from UTF-8", e); } if (userName.length() == 0) { userName = peerPrincipal.getName(); } final AuthorizeCallback authorizeCallback = new AuthorizeCallback(peerPrincipal.getName(), userName); handleCallback(callbackHandler, authorizeCallback); if (authorizeCallback.isAuthorized()) { authorizationID = authorizeCallback.getAuthorizedID(); } else { throw new SaslException("EXTERNAL: " + peerPrincipal.getName() + " is not authorized to act as " + userName); } return EMPTY; }
authorizedId = ac.getAuthorizedID(); } else { throw new XmppSaslException(SaslError.invalid_authzid, "PLAIN: " + authcid + " is not authorized to act as "
public byte[] evaluateResponse(final byte[] response) throws SaslException { if (complete) { throw saslExternal.mechMessageAfterComplete().toSaslException(); } complete = true; String authorizationId; if (response.length == 0) { authorizationId = null; } else { authorizationId = Normalizer.normalize(new String(response, StandardCharsets.UTF_8), Normalizer.Form.NFKC); if (authorizationId.indexOf(0) != -1) { throw saslExternal.mechUserNameContainsInvalidCharacter().toSaslException(); } } final AuthorizeCallback authorizeCallback = new AuthorizeCallback(null, authorizationId); try { cbh.handle(Arrays2.of(authorizeCallback)); } catch (SaslException e) { throw e; } catch (IOException e) { throw saslExternal.mechAuthorizationFailed(e).toSaslException(); } catch (UnsupportedCallbackException e) { throw saslExternal.mechAuthorizationFailed(e).toSaslException(); } if (!authorizeCallback.isAuthorized()) { throw saslExternal.mechAuthorizationFailed(null, authorizationId).toSaslException(); } this.authorizationID = authorizeCallback.getAuthorizedID(); return null; }
public byte[] evaluateResponse(final byte[] response) throws SaslException { if (complete) { throw saslExternal.mechMessageAfterComplete().toSaslException(); } complete = true; String authorizationId; if (response.length == 0) { authorizationId = null; } else { authorizationId = Normalizer.normalize(new String(response, StandardCharsets.UTF_8), Normalizer.Form.NFKC); if (authorizationId.indexOf(0) != -1) { throw saslExternal.mechUserNameContainsInvalidCharacter().toSaslException(); } } final AuthorizeCallback authorizeCallback = new AuthorizeCallback(null, authorizationId); try { cbh.handle(Arrays2.of(authorizeCallback)); } catch (SaslException e) { throw e; } catch (IOException e) { throw saslExternal.mechAuthorizationFailed(e).toSaslException(); } catch (UnsupportedCallbackException e) { throw saslExternal.mechAuthorizationFailed(e).toSaslException(); } if (!authorizeCallback.isAuthorized()) { throw saslExternal.mechAuthorizationFailed(null, authorizationId).toSaslException(); } this.authorizationID = authorizeCallback.getAuthorizedID(); return null; }
public byte[] evaluateResponse(final byte[] response) throws SaslException { if (complete) { throw saslExternal.mechMessageAfterComplete().toSaslException(); } complete = true; String authorizationId; if (response.length == 0) { authorizationId = null; } else { authorizationId = Normalizer.normalize(new String(response, StandardCharsets.UTF_8), Normalizer.Form.NFKC); if (authorizationId.indexOf(0) != -1) { throw saslExternal.mechUserNameContainsInvalidCharacter().toSaslException(); } } final AuthorizeCallback authorizeCallback = new AuthorizeCallback(null, authorizationId); try { cbh.handle(Arrays2.of(authorizeCallback)); } catch (SaslException e) { throw e; } catch (IOException e) { throw saslExternal.mechAuthorizationFailed(e).toSaslException(); } catch (UnsupportedCallbackException e) { throw saslExternal.mechAuthorizationFailed(e).toSaslException(); } if (!authorizeCallback.isAuthorized()) { throw saslExternal.mechAuthorizationFailed(null, authorizationId).toSaslException(); } this.authorizationID = authorizeCallback.getAuthorizedID(); return null; }