Package org.encuestame.core.security.token

Examples of org.encuestame.core.security.token.SocialAuthenticationToken


      */
    @Override
    public Authentication authenticate(Authentication authentication)
            throws AuthenticationException {
        if (authentication instanceof SocialAuthenticationToken) {
            SocialAuthenticationToken response = (SocialAuthenticationToken) authentication;
            // handle the various possibilities
                // Lookup user details
                UserDetails userDetails;
                try {
                    userDetails = socialUserService.loadAccountConnection(response.getProfileId(), response.getProvider());
                    //logger.debug("user details "+userDetails);
                } catch (EnMeNoSuchAccountConnectionException e) {
                    throw new BadCredentialsException(e.getMessage());
                }
            Authentication auth = createSuccessAuthentication(response);
View Full Code Here


     * @return
     */
    protected Authentication createSuccessAuthentication(SocialAuthenticationToken authentication) {
        //TODO: in the future add more conditionals to block accounts.
        Object user = authentication.getPrincipal();
        final SocialAuthenticationToken result = new SocialAuthenticationToken(user, authentication.getAuthorities());
        result.setProfileId(authentication.getProfileId());
        result.setProvider(authentication.getProvider());
        if (logger.isDebugEnabled()) {
            //logger.debug("createSuccessAuthentication "+result);
        }
        return result;
    }
View Full Code Here

                .convertEnMePermission(account.getSecUserPermissions());
        // create user detail based on user account.
        final EnMeSocialUserAccount details = SecurityUtils.convertUserAccountToUserDetails(accountConnection);
        // set the social credentials permission.
        details.setSocialCredentials(true);
        final SocialAuthenticationToken token = new SocialAuthenticationToken(details, authorities);
        token.setProfileId(accountConnection.getSocialProfileId());
        token.setProvider(accountConnection.getAccounType());
        //clear the context.
        SecurityContextHolder.clearContext();
        //set new authentication.
        SecurityContextHolder.getContext().setAuthentication(token);
        if (log.isInfoEnabled()) {
View Full Code Here

TOP

Related Classes of org.encuestame.core.security.token.SocialAuthenticationToken

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.