Package org.apache.cxf.common.security

Examples of org.apache.cxf.common.security.UsernameToken


            if (context == null || context.getMessageContext() == null) {
                throw new STSException("No message context found");
            }
            //find the username
            MessageContext ctx = context.getMessageContext();
            UsernameToken unt = (UsernameToken)ctx.get(SecurityToken.class.getName());
            if (unt != null) {
                username = unt.getName();
            }
        }

        // check input arguments
        if (certificate != null) { // certificate
View Full Code Here


            if (p != null) {
                msg.put(PRINCIPAL_RESULT, p);
                if (!utWithCallbacks && p instanceof WSUsernameTokenPrincipal) {
                    WSUsernameTokenPrincipal utp = (WSUsernameTokenPrincipal)p;
                    msg.put(org.apache.cxf.common.security.SecurityToken.class,
                            new UsernameToken(utp.getName(),
                                              utp.getPassword(),
                                              utp.getPasswordType(),
                                              utp.isPasswordDigest(),
                                              utp.getNonce(),
                                              utp.getCreatedTime()));
View Full Code Here

            if (context == null || context.getMessageContext() == null) {
                throw new STSException("No message context found");
            }
            //find the username
            MessageContext ctx = context.getMessageContext();
            UsernameToken unt = (UsernameToken)ctx.get(SecurityToken.class.getName());
            if (unt != null) {
                username = unt.getName();
            }
        }

        // check input arguments
        if (certificate != null) { // certificate
View Full Code Here

        SecurityContext context = msg.get(SecurityContext.class);
        if (token == null || context == null || context.getUserPrincipal() == null) {
            super.handleMessage(msg);
            return;
        }
        UsernameToken ut = (UsernameToken)token;
       
        Subject subject = createSubject(ut.getName(), ut.getPassword(), ut.isHashed(),
                                        ut.getNonce(), ut.getCreatedTime());
       
        SecurityContext sc = doCreateSecurityContext(context.getUserPrincipal(), subject);
        msg.put(SecurityContext.class, sc);
    }
View Full Code Here

            password = policy.getPassword();
        } else {
            // try the UsernameToken
            SecurityToken token = message.get(SecurityToken.class);
            if (token != null && token.getTokenType() == TokenType.UsernameToken) {
                UsernameToken ut = (UsernameToken)token;
                name = ut.getName();
                password = ut.getPassword();
            }
        }
       
        if (name == null || password == null) {
            org.apache.cxf.common.i18n.Message errorMsg =
View Full Code Here

            if (context == null || context.getMessageContext() == null) {
                throw new STSException("No message context found");
            }
            //find the username
            MessageContext ctx = context.getMessageContext();
            UsernameToken unt = (UsernameToken)ctx.get(SecurityToken.class.getName());
            if (unt != null) {
                username = unt.getName();
            }
        }

        // check input arguments
        if (certificate != null) { // certificate
View Full Code Here

            password = policy.getPassword();
        } else {
            // try the UsernameToken
            SecurityToken token = message.get(SecurityToken.class);
            if (token != null && token.getTokenType() == TokenType.UsernameToken) {
                UsernameToken ut = (UsernameToken)token;
                name = ut.getName();
                password = ut.getPassword();
            }
        }

        if (name == null || password == null) {
            throw new AuthenticationException("Authentication required but no user or password was supplied");
View Full Code Here

            password = policy.getPassword();
        } else {
            // try the UsernameToken
            SecurityToken token = message.get(SecurityToken.class);
            if (token != null && token.getTokenType() == TokenType.UsernameToken) {
                UsernameToken ut = (UsernameToken)token;
                name = ut.getName();
                password = ut.getPassword();
            }
        }
       
        if (name == null || password == null) {
            org.apache.cxf.common.i18n.Message errorMsg =
View Full Code Here

        SecurityContext context = msg.get(SecurityContext.class);
        if (token == null || context == null || context.getUserPrincipal() == null) {
            super.handleMessage(msg);
            return;
        }
        UsernameToken ut = (UsernameToken)token;
       
        Subject subject = createSubject(ut.getName(), ut.getPassword(), ut.isHashed(),
                                        ut.getNonce(), ut.getCreatedTime());
       
        SecurityContext sc = doCreateSecurityContext(context.getUserPrincipal(), subject);
        msg.put(SecurityContext.class, sc);
    }
View Full Code Here

            String nonce = null;
            if (utp.getNonce() != null) {
                nonce = Base64Utility.encode(utp.getNonce());
            }
            msg.put(org.apache.cxf.common.security.SecurityToken.class,
                    new UsernameToken(utp.getName(),
                                      utp.getPassword(),
                                      utp.getPasswordType(),
                                      utp.isPasswordDigest(),
                                      nonce,
                                      utp.getCreatedTime()));
View Full Code Here

TOP

Related Classes of org.apache.cxf.common.security.UsernameToken

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.