当前位置: 首页>>代码示例>>Java>>正文


Java SocialUser类代码示例

本文整理汇总了Java中org.springframework.social.security.SocialUser的典型用法代码示例。如果您正苦于以下问题:Java SocialUser类的具体用法?Java SocialUser怎么用?Java SocialUser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SocialUser类属于org.springframework.social.security包,在下文中一共展示了SocialUser类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadUserByUserId

import org.springframework.social.security.SocialUser; //导入依赖的package包/类
@Override
@Transactional(readOnly = true)
public SocialUserDetails loadUserByUserId(final String uuid) throws UsernameNotFoundException, DataAccessException {
    log.debug("Authenticating {} from social login", uuid);

    Optional<User> userFromDatabase = userRepository.findOneByUuid(uuid);

    return userFromDatabase.map(user -> {
        if (!user.isActivated()) {
            throw new UserNotActivatedException("User " + uuid + " was not activated");
        }
        List<GrantedAuthority> grantedAuthorities = user.getAuthorities().stream()
            .map(authority -> new SimpleGrantedAuthority(authority.name()))
            .collect(Collectors.toList());
        log.debug("Login successful");
        return new SocialUser(uuid,
            UUID.randomUUID().toString(),
            grantedAuthorities);
    }).orElseThrow(() -> new UsernameNotFoundException("User " + uuid + " was not found in the database"));
}
 
开发者ID:esutoniagodesu,项目名称:egd-web,代码行数:21,代码来源:SimpleSocialUserDetailsService.java

示例2: loadUserByUserId

import org.springframework.social.security.SocialUser; //导入依赖的package包/类
@Override
public SocialUserDetails loadUserByUserId(String userId) throws UsernameNotFoundException {
    return new SocialUser(userId, "", Collections.emptyList());
}
 
开发者ID:Turbots,项目名称:SpringOne2016,代码行数:5,代码来源:SimpleSocialUserDetailsService.java

示例3: loadUserByUserId

import org.springframework.social.security.SocialUser; //导入依赖的package包/类
@Override
public SocialUserDetails loadUserByUserId(String username) throws UsernameNotFoundException {
    UserDetails details = userDetailsManager.loadUserByUsername(username);
    return new SocialUser(details.getUsername(), "", AuthorityUtils.createAuthorityList("USER"));
}
 
开发者ID:pazuzu-io,项目名称:pazuzu-registry,代码行数:6,代码来源:SimpleSocialUserDetailsService.java

示例4: loadUserByUserId

import org.springframework.social.security.SocialUser; //导入依赖的package包/类
@Override
public SocialUserDetails loadUserByUserId(String userId) throws UsernameNotFoundException, DataAccessException {
    UserDetails userDetails = userDetailsService.loadUserByUsername(userId);
    return new SocialUser(userDetails.getUsername(), userDetails.getPassword(), userDetails.getAuthorities());
}
 
开发者ID:miosman,项目名称:kotoby,代码行数:6,代码来源:SimpleSocialUsersDetailService.java

示例5: loadUserByUserId

import org.springframework.social.security.SocialUser; //导入依赖的package包/类
@Override
public SocialUserDetails loadUserByUserId(String userId) throws UsernameNotFoundException, DataAccessException {
	UserDetails userDetails = userDetailsService.loadUserByUsername(userId);
	return new SocialUser(userDetails.getUsername(), userDetails.getPassword(), userDetails.getAuthorities());
}
 
开发者ID:markoradinovic,项目名称:Vaadin4Spring-MVP-Sample-SpringSecuritySocial,代码行数:6,代码来源:SimpleSocialUsersDetailService.java


注:本文中的org.springframework.social.security.SocialUser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。