Examples of UserSubject


Examples of org.apache.cxf.rs.security.oauth.data.UserSubject

                    Set<Principal> roles = ((LoginSecurityContext)sc).getUserRoles();
                    for (Principal p : roles) {
                        roleNames.add(p.getName());
                    }
                }
                token.setSubject(new UserSubject(sc.getUserPrincipal() == null
                    ? null : sc.getUserPrincipal().getName(), roleNames));
               
                AuthorizationInput input = new AuthorizationInput();
                input.setToken(token);
                
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.UserSubject

        // TODO:
        // This custom parameter is only needed by the "oauth"
        // demo shipped in the distribution; needs to be removed.
        request.setAttribute("oauth_authorities", info.getRoles());
       
        UserSubject subject = info.getToken().getSubject();

        final UserSubject theSubject = subject;
        return new SecurityContext() {

            public Principal getUserPrincipal() {
                String login = AbstractAuthFilter.this.useUserSubject
                    ? (theSubject != null ? theSubject.getLogin() : null)
                    : info.getToken().getClient().getLoginName()
                return new SimplePrincipal(login);
            }

            public boolean isUserInRole(String role) {
                List<String> roles = null;
                if (AbstractAuthFilter.this.useUserSubject && theSubject != null) {
                    roles = theSubject.getRoles();   
                } else {
                    roles = info.getRoles();
                }
                return roles == null ? false : roles.contains(role);
            }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.UserSubject

            
        };
    }
   
    protected OAuthContext createOAuthContext(OAuthInfo info) {
        UserSubject subject = null;
        if (info.getToken() != null) {
            subject = info.getToken().getSubject();
        }
        return new OAuthContext(subject, info.getMatchedPermissions());
    }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.UserSubject

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

            public Principal getUserPrincipal() {
                String login = info.useUserSubject()
                    ? (subject != null ? subject.getLogin() : null)
                    : info.getClient().getLoginName()
                return new SimplePrincipal(login);
            }

            public boolean isUserInRole(String role) {
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.UserSubject

            
        };
    }
   
    protected OAuthContext createOAuthContext(OAuthInfo info) {
        UserSubject subject = null;
        if (info.getToken() != null) {
            subject = info.getToken().getSubject();
        }
        return new OAuthContext(subject, info.getPermissions());
    }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.UserSubject

                    Set<Principal> roles = ((LoginSecurityContext)sc).getUserRoles();
                    for (Principal p : roles) {
                        roleNames.add(p.getName());
                    }
                }
                token.setSubject(new UserSubject(sc.getUserPrincipal().getName(),
                                                 roleNames));
               
                String verifier = dataProvider.setRequestTokenVerifier(token);
                queryParams.put(OAuth.OAUTH_VERIFIER, verifier);
            } else {
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.UserSubject

                    Set<Principal> roles = ((LoginSecurityContext)sc).getUserRoles();
                    for (Principal p : roles) {
                        roleNames.add(p.getName());
                    }
                }
                token.setSubject(new UserSubject(sc.getUserPrincipal() == null
                    ? null : sc.getUserPrincipal().getName(), roleNames));
               
                AuthorizationInput input = new AuthorizationInput();
                input.setToken(token);
                
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth.data.UserSubject

                    Set<Principal> roles = ((LoginSecurityContext)sc).getUserRoles();
                    for (Principal p : roles) {
                        roleNames.add(p.getName());
                    }
                }
                token.setSubject(new UserSubject(sc.getUserPrincipal() == null
                    ? null : sc.getUserPrincipal().getName(), roleNames));
               
                AuthorizationInput input = new AuthorizationInput();
                input.setToken(token);
                
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth2.common.UserSubject

            AssertionWrapper assertionWrapper = new AssertionWrapper(token);
           
            Message message = PhaseInterceptorChain.getCurrentMessage();
   
            validateToken(message, assertionWrapper);
            UserSubject grantSubject = getGrantSubject(message, assertionWrapper);
           
            return doCreateAccessToken(client,
                                       grantSubject,
                                       Constants.SAML2_BEARER_GRANT,
                                       OAuthUtils.parseScope(params.getFirst(OAuthConstants.SCOPE)));
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth2.common.UserSubject

            }
            return new SamlUserSubject(jaxrsSc.getUserPrincipal().getName(),
                                       roles,
                                       jaxrsSc.getClaims());
        } else {
            return new UserSubject(sc.getUserPrincipal().getName());
        }
       
    }
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.