Package org.apache.cxf.configuration.security

Examples of org.apache.cxf.configuration.security.AuthorizationPolicy


        });
       
        Headers headers = new Headers(inMessage);
        headers.copyFromRequest(req);
        String credentials = headers.getAuthorization();
        AuthorizationPolicy authPolicy = getAuthorizationPolicyFromMessage(credentials);
        inMessage.put(AuthorizationPolicy.class, authPolicy);
       
        SSLUtils.propogateSecureSession(req, inMessage);

        inMessage.put(CertConstraints.class.getName(), certConstraints);
View Full Code Here


            if (properties == null) {
                properties = new HashMap<String, Object>();
            }
   
            if (username != null) {
                AuthorizationPolicy authPolicy = new AuthorizationPolicy();
                authPolicy.setUserName(username);
                authPolicy.setPassword(password);
                properties.put(AuthorizationPolicy.class.getName(), authPolicy);
            }
   
            initFeatures();
            clientFactoryBean.setProperties(properties);
View Full Code Here

                        String authInfo[] = authDecoded.split(":");
                        String username = (authInfo.length > 0) ? authInfo[0] : "";
                        // Below line for systems that blank out password after authentication;
                        // see CXF-1495 for more info
                        String password = (authInfo.length > 1) ? authInfo[1] : "";
                        AuthorizationPolicy policy = new AuthorizationPolicy();
                        policy.setUserName(username);
                        policy.setPassword(password);
                       
                        message.put(AuthorizationPolicy.class, policy);
                    } catch (Base64Exception ex) {
                        //ignore, we'll leave things alone.  They can try decoding it themselves
                    }
View Full Code Here

            bp.getRequestContext().remove(BindingProvider.PASSWORD_PROPERTY);
           
            //try setting on the conduit directly
            Client client = ClientProxy.getClient(greeter);
            HTTPConduit httpConduit = (HTTPConduit)client.getConduit();
            AuthorizationPolicy policy = new AuthorizationPolicy();
            policy.setUserName("BJ2");
            policy.setPassword("pswd");
            httpConduit.setAuthorization(policy);
           
            s = greeter.greetMe("secure");
            assertEquals("Hello BJ2", s);
        } catch (UndeclaredThrowableException ex) {
View Full Code Here

        acceptTypes.add("text/plain");
        headers.put("Accept", acceptTypes);
       
        message.put(Message.PROTOCOL_HEADERS, headers);
       
        AuthorizationPolicy authPolicy = new AuthorizationPolicy();
        authPolicy.setUserName("BJ");
        authPolicy.setPassword("value");
        message.put(AuthorizationPolicy.class, authPolicy);       
    }
View Full Code Here

    @Test
    public void testAuthPolicyFromEndpointInfo() throws Exception {
        Bus bus = new CXFBusImpl();
        EndpointInfo ei = new EndpointInfo();
        AuthorizationPolicy ap = new AuthorizationPolicy();
        ap.setPassword("password");
        ap.setUserName("testUser");
        ei.addExtensor(ap);
        ei.setAddress("http://nowhere.com/bar/foo");
        HTTPConduit conduit = new HTTPConduit(bus, ei, null);
        conduit.finalizeConfig();
        Message message = getNewMessage();
View Full Code Here

        assertEquals("Unexpected Authorization Token",
                "Basic " + Base64Utility.encode("Gandalf:staff".getBytes()),
                headers.get("Authorization").get(0));

        // Setting authorization policy on the message should override all.
        AuthorizationPolicy authPolicy = new AuthorizationPolicy();
        authPolicy.setUserName("Hello");
        authPolicy.setPassword("world");
        authPolicy.setAuthorizationType("Basic");
        message = getNewMessage();
        message.put(AuthorizationPolicy.class, authPolicy);

        conduit.prepare(message);
View Full Code Here

        if (properties == null) {
            properties = new HashMap<String, Object>();
        }

        if (username != null) {
            AuthorizationPolicy authPolicy = new AuthorizationPolicy();
            authPolicy.setUserName(username);
            authPolicy.setPassword(password);
            properties.put(AuthorizationPolicy.class.getName(), authPolicy);
        }

        initFeatures();
        clientFactoryBean.setProperties(properties);
View Full Code Here

    }
   
    protected void initClient(AbstractClient client, Endpoint ep, boolean addHeaders) {
       
        if (username != null) {
            AuthorizationPolicy authPolicy = new AuthorizationPolicy();
            authPolicy.setUserName(username);
            authPolicy.setPassword(password);
            ep.getEndpointInfo().addExtensor(authPolicy);
        }
       
        applyFeatures(client);
        client.getConfiguration().setConduitSelector(getConduitSelector(ep));
View Full Code Here

                        String authInfo[] = authDecoded.split(":");
                        String username = (authInfo.length > 0) ? authInfo[0] : "";
                        // Below line for systems that blank out password after authentication;
                        // see CXF-1495 for more info
                        String password = (authInfo.length > 1) ? authInfo[1] : "";
                        AuthorizationPolicy policy = new AuthorizationPolicy();
                        policy.setUserName(username);
                        policy.setPassword(password);
                       
                        message.put(AuthorizationPolicy.class, policy);
                    } catch (Base64Exception ex) {
                        //ignore, we'll leave things alone.  They can try decoding it themselves
                    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.configuration.security.AuthorizationPolicy

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.