Package org.apache.cxf.security

Examples of org.apache.cxf.security.SecurityContext


   
    /*
     * Create a security context object
     */
    private SecurityContext createSecurityContext(final Principal p) {
        return new SecurityContext() {
            public Principal getUserPrincipal() {
                return p;
            }
            public boolean isUserInRole(String role) {
                return false;
View Full Code Here


    }
   
    protected SecurityContext createSecurityContext(HttpServletRequest request,
                                                    final OAuthInfo info) {
        request.setAttribute("oauth_authorities", info.getRoles());
        return new SecurityContext() {

            public Principal getUserPrincipal() {
                return new SimplePrincipal(info.getClient().getLoginName());
            }
View Full Code Here

        }
    }

    protected HttpServletRequest setSecurityContext(HttpServletRequest request,
                                                    OAuthInfo info) {
        final SecurityContext sc = createSecurityContext(request, info);
        HttpServletRequest newRequest = new HttpServletRequestWrapper(request) {
       
            @Override
            public Principal getUserPrincipal() {
                return sc.getUserPrincipal();
            }
           
            @Override
            public boolean isUserInRole(String role) {
                return sc.isUserInRole(role);
            }
           
            @Override
            public String getAuthType() {
                return "OAuth";
View Full Code Here

        return null;
    }

    private void setSecurityContext(Message m, OAuthInfo info) {
       
        SecurityContext sc = createSecurityContext(mc.getHttpServletRequest(), info);
        m.setContent(SecurityContext.class, sc);
    }
View Full Code Here

        if (!StringUtils.isEmpty(basePath)) {
            inMessage.put(Message.BASE_PATH, basePath);
        }
        inMessage.put(Message.FIXED_PARAMETER_ORDER, isFixedParameterOrder());
        inMessage.put(Message.ASYNC_POST_RESPONSE_DISPATCH, Boolean.TRUE);
        inMessage.put(SecurityContext.class, new SecurityContext() {
            public Principal getUserPrincipal() {
                return req.getUserPrincipal();
            }
            public boolean isUserInRole(String role) {
                return req.isUserInRole(role);
View Full Code Here

        if (!StringUtils.isEmpty(basePath)) {
            inMessage.put(Message.BASE_PATH, basePath);
        }
        inMessage.put(Message.FIXED_PARAMETER_ORDER, isFixedParameterOrder());
        inMessage.put(Message.ASYNC_POST_RESPONSE_DISPATCH, Boolean.TRUE);
        inMessage.put(SecurityContext.class, new SecurityContext() {
            public Principal getUserPrincipal() {
                return req.getUserPrincipal();
            }
            public boolean isUserInRole(String role) {
                return req.isUserInRole(role);
View Full Code Here

       
        for (WSSecurityEngineResult o : CastUtils.cast(wsResult, WSSecurityEngineResult.class)) {
            final Principal p = (Principal)o.get(WSSecurityEngineResult.TAG_PRINCIPAL);
            if (p != null) {
                msg.put(PRINCIPAL_RESULT, p);                  
                SecurityContext sc = msg.get(SecurityContext.class);
                if (sc == null || sc.getUserPrincipal() == null) {
                    msg.put(SecurityContext.class, createSecurityContext(p));
                    break;
                }
            }           
        }
View Full Code Here

        }
    }

   
    protected SecurityContext createSecurityContext(final Principal p) {
        return new SecurityContext() {
            public Principal getUserPrincipal() {
                return p;
            }
            public boolean isUserInRole(String role) {
                return false;
View Full Code Here

            inMessage.put(Message.BASE_PATH, basePath);
        }
        inMessage.put(Message.FIXED_PARAMETER_ORDER, isFixedParameterOrder());
        inMessage.put(Message.ASYNC_POST_RESPONSE_DISPATCH, Boolean.TRUE);
        final Principal pp = req.getUserPrincipal();
        inMessage.put(SecurityContext.class, new SecurityContext() {
            public Principal getUserPrincipal() {
                return pp;
            }
            public boolean isUserInRole(String role) {
                return req.isUserInRole(role);
View Full Code Here

                                                Integer.valueOf(val));
                }
            }
            inMessage.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, protHeaders);

            SecurityContext securityContext = buildSecurityContext(message, jmsConfig);
            inMessage.put(SecurityContext.class, securityContext);

            populateIncomingMessageProperties(message, inMessage, messageProperties);
        } catch (JMSException ex) {
            throw JmsUtils.convertJmsAccessException(ex);
View Full Code Here

TOP

Related Classes of org.apache.cxf.security.SecurityContext

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.