public boolean authenticateUser( Map context, String username, String passwordDigest, String nonce, String created) throws XWSSecurityException { PasswordValidationCallback.DigestPasswordRequest request = new PasswordValidationCallback.DigestPasswordRequest( username, passwordDigest, nonce, created); PasswordValidationCallback passwordValidationCallback = new PasswordValidationCallback(request); if (!isDefaultHandler) { ProcessingContext.copy(passwordValidationCallback.getRuntimeProperties(), context); } Callback[] callbacks = new Callback[]{passwordValidationCallback}; try { callbackHandler.handle(callbacks); } catch (Exception e) { log.log(Level.SEVERE, "WSS0225.error.PasswordValidationCallback", e); throw new XWSSecurityException(e); } if (log.isLoggable(Level.FINE)) { log.log(Level.FINE, "Username Authentication done for " + username); } return passwordValidationCallback.getResult(); }
public boolean validate(Request request) throws PasswordValidationException { String passwd = req.getPassword(); String nonce = req.getNonce(); String created = req.getCreated(); String passwordDigest = req.getDigest();
PasswordValidationCallback.DigestPasswordRequest request = (PasswordValidationCallback.DigestPasswordRequest) passwordCallback.getRequest(); String username = request.getUsername(); UserDetails user = loadUserDetails(username); if (user != null) { SpringSecurityUtils.checkUserValidity(user); request.setPassword(user.getPassword());
PasswordValidationCallback.DigestPasswordRequest request = (PasswordValidationCallback.DigestPasswordRequest) passwordCallback.getRequest(); String username = request.getUsername(); UserDetails user = loadUserDetails(username); if (user != null) { SpringSecurityUtils.checkUserValidity(user); request.setPassword(user.getPassword());
PasswordValidationCallback.DigestPasswordRequest request = (PasswordValidationCallback.DigestPasswordRequest) passwordCallback.getRequest(); String username = request.getUsername(); UserDetails user = loadUserDetails(username); if (user != null) { SpringSecurityUtils.checkUserValidity(user); request.setPassword(user.getPassword());
@Override protected void handleInternal(Callback callback) throws IOException, UnsupportedCallbackException { if (callback instanceof PasswordValidationCallback) { PasswordValidationCallback passwordCallback = (PasswordValidationCallback) callback; if (passwordCallback.getRequest() instanceof PasswordValidationCallback.PlainTextPasswordRequest) { passwordCallback.setValidator(new SimplePlainTextPasswordValidator()); } else if (passwordCallback.getRequest() instanceof PasswordValidationCallback.DigestPasswordRequest) { PasswordValidationCallback.DigestPasswordRequest digestPasswordRequest = (PasswordValidationCallback.DigestPasswordRequest) passwordCallback.getRequest(); String password = users.get(digestPasswordRequest.getUsername()); digestPasswordRequest.setPassword(password); passwordCallback.setValidator(new PasswordValidationCallback.DigestPasswordValidator()); } } else if (callback instanceof TimestampValidationCallback) { TimestampValidationCallback timestampCallback = (TimestampValidationCallback) callback; timestampCallback.setValidator(new DefaultTimestampValidator()); } else { throw new UnsupportedCallbackException(callback); } }
@Override protected void handleInternal(Callback callback) throws IOException, UnsupportedCallbackException { if (callback instanceof PasswordValidationCallback) { PasswordValidationCallback passwordCallback = (PasswordValidationCallback) callback; if (passwordCallback.getRequest() instanceof PasswordValidationCallback.PlainTextPasswordRequest) { passwordCallback.setValidator(new SimplePlainTextPasswordValidator()); } else if (passwordCallback.getRequest() instanceof PasswordValidationCallback.DigestPasswordRequest) { PasswordValidationCallback.DigestPasswordRequest digestPasswordRequest = (PasswordValidationCallback.DigestPasswordRequest) passwordCallback.getRequest(); String password = users.get(digestPasswordRequest.getUsername()); digestPasswordRequest.setPassword(password); passwordCallback.setValidator(new PasswordValidationCallback.DigestPasswordValidator()); } } else if (callback instanceof TimestampValidationCallback) { TimestampValidationCallback timestampCallback = (TimestampValidationCallback) callback; timestampCallback.setValidator(new DefaultTimestampValidator()); } else { throw new UnsupportedCallbackException(callback); } }
@Override protected void handleInternal(Callback callback) throws IOException, UnsupportedCallbackException { if (callback instanceof PasswordValidationCallback) { PasswordValidationCallback passwordCallback = (PasswordValidationCallback) callback; if (passwordCallback.getRequest() instanceof PasswordValidationCallback.PlainTextPasswordRequest) { passwordCallback.setValidator(new SimplePlainTextPasswordValidator()); } else if (passwordCallback.getRequest() instanceof PasswordValidationCallback.DigestPasswordRequest) { PasswordValidationCallback.DigestPasswordRequest digestPasswordRequest = (PasswordValidationCallback.DigestPasswordRequest) passwordCallback.getRequest(); String password = users.get(digestPasswordRequest.getUsername()); digestPasswordRequest.setPassword(password); passwordCallback.setValidator(new PasswordValidationCallback.DigestPasswordValidator()); } } else if (callback instanceof TimestampValidationCallback) { TimestampValidationCallback timestampCallback = (TimestampValidationCallback) callback; timestampCallback.setValidator(new DefaultTimestampValidator()); } else { throw new UnsupportedCallbackException(callback); } }