Package org.apache.cxf.common.security

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


            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


                name = policy.getUserName();
            } else {
                // try the UsernameToken
                SecurityToken token = message.get(SecurityToken.class);
                if (token != null && token.getTokenType() == TokenType.UsernameToken) {
                    UsernameToken ut = (UsernameToken)token;
                    name = ut.getName();
                }
            }
            return new DefaultSecurityContext(name, subject);
        }
    }
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

   
    protected Subject createSubject(SecurityToken token) {
        if (token.getTokenType() != TokenType.UsernameToken) {
            reportSecurityException("Unsupported token type " + token.getTokenType().toString());
        }
        UsernameToken ut = (UsernameToken)token;
        return createSubject(ut);
    }
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

   
    public static void convertToken(Message msg, Principal p) {
        if (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

            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

    public void testIssueDelegate() {
       
        WebServiceContext context = EasyMock.createNiceMock(WebServiceContext.class);
        MessageContext ctx2 = EasyMock.createNiceMock(MessageContext.class);
        EasyMock.expect(context.getMessageContext()).andReturn(ctx2).anyTimes();
        UsernameToken token = new UsernameToken("joe", null, null, false, null, null);
        EasyMock.expect(ctx2.get(SecurityToken.class.getName())).andReturn(token).anyTimes();

       
        SAMLTokenIssueOperation id = new SAMLTokenIssueOperation();
        CertificateVerifierConfig certificateVerifierConfig = new CertificateVerifierConfig();
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.