Package com.sun.xml.wss.impl.callback

Examples of com.sun.xml.wss.impl.callback.PasswordValidationCallback


     *          when the callback is not supported
     */
    @Override
    protected void handleInternal(Callback callback) throws IOException, UnsupportedCallbackException {
        if (callback instanceof PasswordValidationCallback) {
            PasswordValidationCallback validationCallback = (PasswordValidationCallback) callback;
            if (validationCallback.getRequest() instanceof PasswordValidationCallback.PlainTextPasswordRequest) {
                validationCallback.setValidator(new SpringSecurityPlainTextPasswordValidator());
                return;
            }
        }
        else if (callback instanceof CleanupCallback) {
            SecurityContextHolder.clearContext();
View Full Code Here


        if (callback instanceof CertificateValidationCallback) {
            CertificateValidationCallback validationCallback = (CertificateValidationCallback) callback;
            validationCallback.setValidator(new MockCertificateValidator());
        }
        else if (callback instanceof PasswordValidationCallback) {
            PasswordValidationCallback validationCallback = (PasswordValidationCallback) callback;
            validationCallback.setValidator(new MockPasswordValidator());
        }
        else {
            throw new UnsupportedCallbackException(callback);
        }
    }
View Full Code Here

     *          when the callback is not supported
     */
    @Override
    protected void handleInternal(Callback callback) throws IOException, UnsupportedCallbackException {
        if (callback instanceof PasswordValidationCallback) {
            PasswordValidationCallback passwordCallback = (PasswordValidationCallback) callback;
            if (passwordCallback.getRequest() instanceof PasswordValidationCallback.DigestPasswordRequest) {
                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());
                }
                SpringSecurityDigestPasswordValidator validator = new SpringSecurityDigestPasswordValidator(user);
                passwordCallback.setValidator(validator);
                return;
            }
        }
        else if (callback instanceof TimestampValidationCallback) {
            TimestampValidationCallback timestampCallback = (TimestampValidationCallback) callback;
View Full Code Here

    }

    @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());
View Full Code Here

     * @throws UnsupportedCallbackException when the callback is not supported
     */
    @Override
    protected final void handleInternal(Callback callback) throws UnsupportedCallbackException {
        if (callback instanceof PasswordValidationCallback) {
            PasswordValidationCallback validationCallback = (PasswordValidationCallback) callback;
            if (validationCallback.getRequest() instanceof PasswordValidationCallback.PlainTextPasswordRequest) {
                validationCallback.setValidator(new JaasPlainTextPasswordValidator());
                return;
            }
        }
        throw new UnsupportedCallbackException(callback);
    }
View Full Code Here

    @Test
    public void testPlainTextPasswordValid() throws Exception {
        PasswordValidationCallback.PlainTextPasswordRequest request =
                new PasswordValidationCallback.PlainTextPasswordRequest("Bert", "Ernie");
        PasswordValidationCallback callback = new PasswordValidationCallback(request);
        handler.handleInternal(callback);
        boolean authenticated = callback.getResult();
        Assert.assertTrue("Not authenticated", authenticated);
    }
View Full Code Here

    @Test
    public void testPlainTextPasswordInvalid() throws Exception {
        PasswordValidationCallback.PlainTextPasswordRequest request =
                new PasswordValidationCallback.PlainTextPasswordRequest("Bert", "Big bird");
        PasswordValidationCallback callback = new PasswordValidationCallback(request);
        handler.handleInternal(callback);
        boolean authenticated = callback.getResult();
        Assert.assertFalse("Authenticated", authenticated);
    }
View Full Code Here

    @Test
    public void testPlainTextPasswordNoSuchUser() throws Exception {
        PasswordValidationCallback.PlainTextPasswordRequest request =
                new PasswordValidationCallback.PlainTextPasswordRequest("Big bird", "Bert");
        PasswordValidationCallback callback = new PasswordValidationCallback(request);
        handler.handleInternal(callback);
        boolean authenticated = callback.getResult();
        Assert.assertFalse("Authenticated", authenticated);
    }
View Full Code Here

        String nonce = "9mdsYDCrjjYRur0rxzYt2oD7";
        String passwordDigest = "kwNstEaiFOrI7B31j7GuETYvdgk=";
        String creationTime = "2006-06-01T23:48:42Z";
        PasswordValidationCallback.DigestPasswordRequest request =
                new PasswordValidationCallback.DigestPasswordRequest(username, passwordDigest, nonce, creationTime);
        PasswordValidationCallback callback = new PasswordValidationCallback(request);
        handler.handleInternal(callback);
        boolean authenticated = callback.getResult();
        Assert.assertTrue("Authenticated", authenticated);

    }
View Full Code Here

        String nonce = "9mdsYDCrjjYRur0rxzYt2oD7";
        String passwordDigest = "kwNstEaiFOrI7B31j7GuETYvdgk";
        String creationTime = "2006-06-01T23:48:42Z";
        PasswordValidationCallback.DigestPasswordRequest request =
                new PasswordValidationCallback.DigestPasswordRequest(username, passwordDigest, nonce, creationTime);
        PasswordValidationCallback callback = new PasswordValidationCallback(request);
        handler.handleInternal(callback);
        boolean authenticated = callback.getResult();
        Assert.assertFalse("Authenticated", authenticated);

    }
View Full Code Here

TOP

Related Classes of com.sun.xml.wss.impl.callback.PasswordValidationCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.