protected boolean isUserSignedIn() { try { String userId = userIdSource.getUserId(); return userId != null && !"anonymousUser".equals(userId); } catch (IllegalStateException e) { return false; } }
@Override public UserAccount getCurrentUser() { return accountRepository.findByUserId(userIdSource.getUserId()); } }
@Bean @Scope(value="request", proxyMode=ScopedProxyMode.INTERFACES) public ConnectionRepository connectionRepository(UsersConnectionRepository usersConnectionRepository) { return usersConnectionRepository.createConnectionRepository(userIdSource().getUserId()); }
public Wechat getApi() { if (log.isDebugEnabled()) { log.debug("Getting API binding instance for Wechat provider"); } Connection<Wechat> connection = this.usersConnectionRepository.createConnectionRepository(this.userIdSource.getUserId()).findPrimaryConnection(Wechat.class); if (log.isDebugEnabled() && connection == null) { log.debug("No current connection; Returning default WechatTemplate instance."); } return connection != null ? connection.getApi() : null; }
public QQ getApi() { if (log.isDebugEnabled()) { log.debug("Getting API binding instance for Wechat provider"); } Connection<QQ> connection = this.usersConnectionRepository.createConnectionRepository(this.userIdSource.getUserId()).findPrimaryConnection(QQ.class); if (log.isDebugEnabled() && connection == null) { log.debug("No current connection; Returning default FacebookTemplate instance."); } return connection != null ? connection.getApi() : null; }
public Facebook getApi() { if (logger.isDebugEnabled()) { logger.debug("Getting API binding instance for Facebook"); } Connection<Facebook> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(Facebook.class); if (logger.isDebugEnabled() && connection == null) { logger.debug("No current connection; Returning default FacebookTemplate instance."); } return connection != null ? connection.getApi() : null; }
public Twitter getApi() { if (logger.isDebugEnabled()) { logger.debug("Getting API binding instance for Twitter"); } Connection<Twitter> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(Twitter.class); if (logger.isDebugEnabled() && connection == null) { logger.debug("No current connection; Returning default TwitterTemplate instance."); } return connection != null ? connection.getApi() : null; }
public Google getApi() { if (logger.isDebugEnabled()) { logger.debug("Getting API binding instance for Google provider"); } Connection<Google> connection = usersConnectionRepository .createConnectionRepository(userIdSource.getUserId()) .findPrimaryConnection(Google.class); if (logger.isDebugEnabled() && connection == null) { logger.debug("No current connection; Returning default GoogleTemplate instance."); } return connection != null ? connection.getApi() : null; }
public Facebook getApi() { if (logger.isDebugEnabled()) { logger.debug("Getting API binding instance for Facebook"); } Connection<Facebook> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(Facebook.class); if (logger.isDebugEnabled() && connection == null) { logger.debug("No current connection; Returning default FacebookTemplate instance."); } return connection != null ? connection.getApi() : null; }
public LinkedIn getApi() { if (logger.isDebugEnabled()) { logger.debug("Getting API binding instance for LinkedIn"); } Connection<LinkedIn> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(LinkedIn.class); if (logger.isDebugEnabled() && connection == null) { logger.debug("No current connection; Returning default LinkedInTemplate instance."); } return connection != null ? connection.getApi() : null; }
public Weibo getApi() { if (log.isDebugEnabled()) { log.debug("Getting API binding instance for Weibo provider"); } Connection<Weibo> connection = this.usersConnectionRepository.createConnectionRepository(this.userIdSource.getUserId()).findPrimaryConnection(Weibo.class); if (log.isDebugEnabled() && connection == null) { log.debug("No current connection; Returning default WeiboTemplate instance."); } return connection != null ? connection.getApi() : null; } }
public Twitter getApi() { if (logger.isDebugEnabled()) { logger.debug("Getting API binding instance for Twitter"); } Connection<Twitter> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(Twitter.class); if (logger.isDebugEnabled() && connection == null) { logger.debug("No current connection; Returning default TwitterTemplate instance."); } return connection != null ? connection.getApi() : null; }
public LinkedIn getApi() { if (logger.isDebugEnabled()) { logger.debug("Getting API binding instance for LinkedIn"); } Connection<LinkedIn> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(LinkedIn.class); if (logger.isDebugEnabled() && connection == null) { logger.debug("No current connection; Returning default LinkedInTemplate instance."); } return connection != null ? connection.getApi() : null; }
public SpringSocialSecurity getApi() { if (logger.isDebugEnabled()) { logger.debug("Getting API binding instance for SpringSocialSecurity"); } Connection<SpringSocialSecurity> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(SpringSocialSecurity.class); if (logger.isDebugEnabled() && connection == null) { logger.debug("No current connection; Returning default SpringSocialSecurity instance."); } return connection != null ? connection.getApi() : null; }
@Override public Salesforce getApi() { Connection<Salesforce> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(Salesforce.class); if (logger.isDebugEnabled() && connection == null) { logger.debug("No current connection; Returning default TwitterTemplate instance."); } return connection != null ? connection.getApi() : null; }
public ZAuth getApi() { Connection<ZAuth> connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()) .findPrimaryConnection(ZAuth.class); return connection != null ? connection.getApi() : null; } }
String currentUserId = userIdSource.getUserId(); usersConnectionRepository.createConnectionRepository(currentUserId).removeConnections(providerId); if (logger.isDebugEnabled()) {
private void addConnection(final SocialAuthenticationService<?> authService, HttpServletRequest request, SocialAuthenticationToken token, Authentication auth) { // already authenticated - add connection instead String userId = userIdSource.getUserId(); Object principal = token.getPrincipal(); if (userId == null || !(principal instanceof ConnectionData)) return; Connection<?> connection = addConnection(authService, userId, (ConnectionData) principal); if (connection != null) { String redirectUrl = authService.getConnectionAddedRedirectUrl(request, connection); if (redirectUrl == null) { // use default instead redirectUrl = connectionAddedRedirectUrl; } throw new SocialAuthenticationRedirectException(redirectUrl); } }
private void addConnection(final SocialAuthenticationService<?> authService, HttpServletRequest request, SocialAuthenticationToken token, Authentication auth) { // already authenticated - add connection instead String userId = userIdSource.getUserId(); Object principal = token.getPrincipal(); if (userId == null || !(principal instanceof ConnectionData)) return; Connection<?> connection = addConnection(authService, userId, (ConnectionData) principal); if(connection != null) { String redirectUrl = authService.getConnectionAddedRedirectUrl(request, connection); if (redirectUrl == null) { // use default instead redirectUrl = connectionAddedRedirectUrl; } throw new SocialAuthenticationRedirectException(redirectUrl); } }
try alreadyAuthenticatedUserId = userIdSource.getUserId();