Examples of WSUsernameTokenPrincipalImpl


Examples of org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl

    ) throws Base64DecodingException {
        boolean hashed = false;
        if (WSConstants.PASSWORD_DIGEST.equals(passwordType)) {
            hashed = true;
        }
        WSUsernameTokenPrincipalImpl principal = new WSUsernameTokenPrincipalImpl(username, hashed);
        principal.setNonce(Base64.decode(nonce));
        principal.setPassword(passwordValue);
        principal.setCreatedTime(createdTime);
        principal.setPasswordType(passwordType);
        return principal;
    }
View Full Code Here

Examples of org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl

                    result.put(WSSecurityEngineResult.TAG_PRINCIPAL, samlPrincipal);
                }
            } else if (credential.getPrincipal() != null) {
                result.put(WSSecurityEngineResult.TAG_PRINCIPAL, credential.getPrincipal());
            } else {
                WSUsernameTokenPrincipalImpl principal =
                    new WSUsernameTokenPrincipalImpl(token.getName(), token.isHashed());
                principal.setNonce(Base64.decodeBase64(token.getNonce()));
                principal.setPassword(token.getPassword());
                principal.setCreatedTime(token.getCreated());
                principal.setPasswordType(token.getPasswordType());
                result.put(WSSecurityEngineResult.TAG_PRINCIPAL, principal);
            }
            result.put(WSSecurityEngineResult.TAG_SUBJECT, credential.getSubject());
        }
       
View Full Code Here

Examples of org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl

                );
                SAMLTokenPrincipalImpl samlPrincipal =
                    new SAMLTokenPrincipalImpl(credential.getTransformedToken());
                result.put(WSSecurityEngineResult.TAG_PRINCIPAL, samlPrincipal);
            } else {
                WSUsernameTokenPrincipalImpl principal =
                    new WSUsernameTokenPrincipalImpl(token.getName(), token.isHashed());
                principal.setNonce(Base64.decodeBase64(token.getNonce()));
                principal.setPassword(token.getPassword());
                principal.setCreatedTime(token.getCreated());
                principal.setPasswordType(token.getPasswordType());
                result.put(WSSecurityEngineResult.TAG_PRINCIPAL, principal);
            }
            result.put(WSSecurityEngineResult.TAG_SUBJECT, credential.getSubject());
        }
       
View Full Code Here

Examples of org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl

    /**
     * Create a WSUsernameTokenPrincipal from this UsernameToken object
     */
    public Principal createPrincipal() throws WSSecurityException {
        try {
            WSUsernameTokenPrincipalImpl principal =
                new WSUsernameTokenPrincipalImpl(getName(), isHashed());
            principal.setNonce(Base64.decode(getNonce()));
            principal.setPassword(getPassword());
            principal.setCreatedTime(getCreated());
            return principal;
        } catch (Base64DecodingException e) {
            throw new WSSecurityException(
                    WSSecurityException.ErrorCode.FAILURE, "decoding.general", e
            );
View Full Code Here

Examples of org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl

    public Credential validate(Credential credential, RequestData data) throws WSSecurityException {
        Credential cred = super.validate(credential, data);
       
        UsernameToken ut = credential.getUsernametoken();
        WSUsernameTokenPrincipalImpl principal =
            new WSUsernameTokenPrincipalImpl(ut.getName(), ut.isHashed());
        principal.setCreatedTime(ut.getCreated());
        principal.setNonce(principal.getNonce());
        principal.setPassword(ut.getPassword());
        principal.setPasswordType(ut.getPasswordType());
       
        Subject subject = new Subject();
        subject.getPrincipals().add(principal);
        if ("Alice".equals(ut.getName())) {
            subject.getPrincipals().add(new SimpleGroup("manager", ut.getName()));
View Full Code Here

Examples of org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl

    ) throws Base64DecodingException {
        boolean hashed = false;
        if (WSConstants.PASSWORD_DIGEST.equals(passwordType)) {
            hashed = true;
        }
        WSUsernameTokenPrincipalImpl principal = new WSUsernameTokenPrincipalImpl(username, hashed);
        principal.setNonce(Base64.decode(nonce));
        principal.setPassword(passwordValue);
        principal.setCreatedTime(createdTime);
        principal.setPasswordType(passwordType);
        return principal;
    }
View Full Code Here

Examples of org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl

        throws WSSecurityException, Base64DecodingException {
        BSPEnforcer bspEnforcer = new BSPEnforcer(!bspCompliant);
        org.apache.wss4j.dom.message.token.UsernameToken ut =
            new org.apache.wss4j.dom.message.token.UsernameToken(tokenElement, false, bspEnforcer);
       
        WSUsernameTokenPrincipalImpl principal = new WSUsernameTokenPrincipalImpl(ut.getName(), ut.isHashed());
        if (ut.getNonce() != null) {
            principal.setNonce(Base64.decode(ut.getNonce()));
        }
        principal.setPassword(ut.getPassword());
        principal.setCreatedTime(ut.getCreated());
        principal.setPasswordType(ut.getPasswordType());

        return principal;
    }
View Full Code Here

Examples of org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl

        throws WSSecurityException, Base64DecodingException {
        BSPEnforcer bspEnforcer = new BSPEnforcer(!bspCompliant);
        org.apache.wss4j.dom.message.token.UsernameToken ut =
            new org.apache.wss4j.dom.message.token.UsernameToken(tokenElement, false, bspEnforcer);
       
        WSUsernameTokenPrincipalImpl principal = new WSUsernameTokenPrincipalImpl(ut.getName(), ut.isHashed());
        if (ut.getNonce() != null) {
            principal.setNonce(Base64.decode(ut.getNonce()));
        }
        principal.setPassword(ut.getPassword());
        principal.setCreatedTime(ut.getCreated());
        principal.setPasswordType(ut.getPasswordType());

        return principal;
    }
View Full Code Here

Examples of org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl

            // Create a Principal/SecurityContext
            Principal p = null;
            if (credential != null && credential.getPrincipal() != null) {
                p = credential.getPrincipal();
            } else {
                p = new WSUsernameTokenPrincipalImpl(policy.getUserName(), false);
                ((WSUsernameTokenPrincipalImpl)p).setPassword(policy.getPassword());
            }
            message.put(SecurityContext.class, createSecurityContext(p));
        } catch (Exception ex) {
            throw new Fault(ex);
View Full Code Here

Examples of org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl

        throws WSSecurityException, Base64DecodingException {
        BSPEnforcer bspEnforcer = new BSPEnforcer(!bspCompliant);
        org.apache.wss4j.dom.message.token.UsernameToken ut =
            new org.apache.wss4j.dom.message.token.UsernameToken(tokenElement, false, bspEnforcer);
       
        WSUsernameTokenPrincipalImpl principal = new WSUsernameTokenPrincipalImpl(ut.getName(), ut.isHashed());
        if (ut.getNonce() != null) {
            principal.setNonce(Base64.decode(ut.getNonce()));
        }
        principal.setPassword(ut.getPassword());
        principal.setCreatedTime(ut.getCreated());
        principal.setPasswordType(ut.getPasswordType());

        return principal;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.