Package com.force.sdk.oauth

Examples of com.force.sdk.oauth.ForceUserPrincipal


        HttpServletRequest req = (HttpServletRequest) request;
        HttpServletResponse res = (HttpServletResponse) response;

        //If a user has been authenticated then the information about that user must be stored
        if (auth != null && auth.getPrincipal() instanceof ForceUserPrincipal) {
            ForceUserPrincipal user = (ForceUserPrincipal) auth.getPrincipal();
            ForceConnectorConfig cc = new ForceConnectorConfig();
            cc.setSessionId(user.getSessionId());
            SecurityContext sc = (SecurityContext) auth.getDetails();
            cc.setServiceEndpoint(sc.getEndPoint());
            cc.setSessionRenewer(this);
            //The security context holder handles the storage of the security context
            ForceSecurityContextHolder.set(sc);
View Full Code Here


     * Use given credentials. Default principal to "Unknown".
     * @param credentials (auth token / session id)
     */
    public OAuthAuthenticationToken(String credentials) {
        super(null);
        this.principal = new ForceUserPrincipal("Unknown", null);
        this.credentials = credentials;
    }
View Full Code Here

     */
    public static Authentication createAuthentication(SecurityContext sc) {
        List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
        authorities.add(new GrantedAuthorityImpl(sc.getRole()));
        OAuthAuthenticationToken newAuthToken =
            new OAuthAuthenticationToken(new ForceUserPrincipal(sc.getUserName(), sc.getSessionId()), null,
            authorities);
        newAuthToken.setDetails(sc.getForceSecurityContext());
        return newAuthToken;
    }
View Full Code Here

   
    private static Authentication createAuthentication(SecurityContext sc) {
        List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
        authorities.add(new GrantedAuthorityImpl("ROLE_USER"));
        OAuthAuthenticationToken newAuthToken =
            new OAuthAuthenticationToken(new ForceUserPrincipal(sc.getUserName(), sc.getSessionId()), null, authorities);
        newAuthToken.setDetails(sc);
        return newAuthToken;
    }
View Full Code Here

        sc.setEndPoint(ENDPOINT);
        sc.setRole("ROLE_USER");
        sc.setUserName("username");
        List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
        authorities.add(new GrantedAuthorityImpl(sc.getRole()));
        OAuthAuthenticationToken newAuthToken = new OAuthAuthenticationToken(new ForceUserPrincipal(sc.getUserName(),
                sc.getSessionId()), null, authorities);
        newAuthToken.setDetails(sc.getForceSecurityContext());

        org.springframework.security.core.context.SecurityContext springSecurityContext = new SecurityContextImpl();
        springSecurityContext.setAuthentication(newAuthToken);
View Full Code Here

TOP

Related Classes of com.force.sdk.oauth.ForceUserPrincipal

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.