本文整理汇总了Java中org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper类的典型用法代码示例。如果您正苦于以下问题:Java GrantedAuthoritiesMapper类的具体用法?Java GrantedAuthoritiesMapper怎么用?Java GrantedAuthoritiesMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GrantedAuthoritiesMapper类属于org.springframework.security.core.authority.mapping包,在下文中一共展示了GrantedAuthoritiesMapper类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createGrantedAuthorities
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; //导入依赖的package包/类
/**
* Creates a {@link GrantedAuthority} collection from the given {@link KeycloakSecurityContext}.
*
* @param context the current <code>RefreshableKeycloakSecurityContext</code> (required)
* @param mapper an optional {@link GrantedAuthoritiesMapper} to convert the
* authorities loaded the given <code>context</code> which will be used in the
* {@code Authentication} object
*
* @return a {@link GrantedAuthority} collection if any; an empty list otherwise
*/
public static Collection<? extends GrantedAuthority> createGrantedAuthorities(RefreshableKeycloakSecurityContext context, GrantedAuthoritiesMapper mapper) {
Assert.notNull(context, "RefreshableKeycloakSecurityContext cannot be null");
List<KeycloakRole> grantedAuthorities = new ArrayList<>();
for (String role : AdapterUtils.getRolesFromSecurityContext(context)) {
grantedAuthorities.add(new KeycloakRole(role));
}
return mapper != null ? mapper.mapAuthorities(grantedAuthorities) : Collections.unmodifiableList(grantedAuthorities);
}
开发者ID:Smartling,项目名称:smartling-keycloak-extras,代码行数:21,代码来源:KeycloakSpringAdapterUtils.java
示例2: ReverseProxyIdolSecurityCustomizer
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; //导入依赖的package包/类
@Autowired
public ReverseProxyIdolSecurityCustomizer(
final UserService userService,
final GrantedAuthoritiesMapper grantedAuthoritiesMapper,
@Value("${find.reverse-proxy.pre-authenticated-roles}") final String preAuthenticatedRoles
) {
this.userService = userService;
this.grantedAuthoritiesMapper = grantedAuthoritiesMapper;
this.preAuthenticatedRoles = preAuthenticatedRoles;
}
开发者ID:hpe-idol,项目名称:find,代码行数:12,代码来源:ReverseProxyIdolSecurityCustomizer.java
示例3: grantedAuthoritiesMapper
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; //导入依赖的package包/类
@Bean
public GrantedAuthoritiesMapper grantedAuthoritiesMapper() {
final Map<String, String> rolesMap = new CaseInsensitiveMap<>();
rolesMap.put(FindCommunityRole.USER.value(), FindRole.USER.toString());
rolesMap.put(FindCommunityRole.ADMIN.value(), FindRole.ADMIN.toString());
if (enableBi) {
rolesMap.put(FindCommunityRole.BI.value(), FindRole.BI.toString());
}
return new OneToOneOrZeroSimpleAuthorityMapper(Collections.unmodifiableMap(rolesMap));
}
开发者ID:hpe-idol,项目名称:find,代码行数:14,代码来源:UserConfiguration.java
示例4: setUp
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; //导入依赖的package包/类
@BeforeMethod
public void setUp()
{
DataService dataService = mock(DataService.class);
User adminUser = when(mock(User.class).isSuperuser()).thenReturn(Boolean.TRUE).getMock();
when(adminUser.getUsername()).thenReturn("admin");
when(adminUser.getPassword()).thenReturn("password");
User userUser = when(mock(User.class).isSuperuser()).thenReturn(Boolean.FALSE).getMock();
when(userUser.getUsername()).thenReturn("user");
when(userUser.getPassword()).thenReturn("password");
Query<User> qAdmin = new QueryImpl<User>().eq(UserMetaData.USERNAME, "admin");
when(dataService.findOne(USER, qAdmin, User.class)).thenReturn(adminUser);
Query<User> qUser = new QueryImpl<User>().eq(UserMetaData.USERNAME, "user");
when(dataService.findOne(USER, qUser, User.class)).thenReturn(userUser);
GrantedAuthoritiesMapper authoritiesMapper = authorities -> authorities;
when(dataService.findAll(USER_AUTHORITY,
new QueryImpl<UserAuthority>().eq(UserAuthorityMetaData.USER, userUser),
UserAuthority.class)).thenAnswer(invocation -> Stream.empty());
when(dataService.findAll(USER_AUTHORITY,
new QueryImpl<UserAuthority>().eq(UserAuthorityMetaData.USER, adminUser),
UserAuthority.class)).thenAnswer(invocation -> Stream.empty());
when(dataService.findAll(GroupMemberMetaData.GROUP_MEMBER,
new QueryImpl<GroupMember>().eq(GroupMemberMetaData.USER, userUser), GroupMember.class)).thenAnswer(
invocation -> Stream.empty());
when(dataService.findAll(GroupMemberMetaData.GROUP_MEMBER,
new QueryImpl<GroupMember>().eq(GroupMemberMetaData.USER, adminUser), GroupMember.class)).thenAnswer(
invocation -> Stream.empty());
userDetailsService = new UserDetailsService(dataService, authoritiesMapper);
}
开发者ID:molgenis,项目名称:molgenis,代码行数:30,代码来源:UserDetailsServiceTest.java
示例5: ImportWizardController
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; //导入依赖的package包/类
@Autowired
public ImportWizardController(UploadWizardPage uploadWizardPage, OptionsWizardPage optionsWizardPage,
PackageWizardPage packageWizardPage, ValidationResultWizardPage validationResultWizardPage,
ImportResultsWizardPage importResultsWizardPage, DataService dataService,
GrantedAuthoritiesMapper grantedAuthoritiesMapper, UserAccountService userAccountService,
ImportServiceFactory importServiceFactory, FileStore fileStore,
FileRepositoryCollectionFactory fileRepositoryCollectionFactory, ImportRunService importRunService,
GroupAuthorityFactory groupAuthorityFactory)
{
super(URI, "importWizard");
if (uploadWizardPage == null) throw new IllegalArgumentException("UploadWizardPage is null");
if (optionsWizardPage == null) throw new IllegalArgumentException("OptionsWizardPage is null");
if (validationResultWizardPage == null)
{
throw new IllegalArgumentException("ValidationResultWizardPage is null");
}
if (importResultsWizardPage == null) throw new IllegalArgumentException("ImportResultsWizardPage is null");
this.uploadWizardPage = uploadWizardPage;
this.optionsWizardPage = optionsWizardPage;
this.validationResultWizardPage = validationResultWizardPage;
this.importResultsWizardPage = importResultsWizardPage;
this.packageWizardPage = packageWizardPage;
this.userAccountService = userAccountService;
this.dataService = dataService;
this.grantedAuthoritiesMapper = grantedAuthoritiesMapper;
this.importServiceFactory = importServiceFactory;
this.fileStore = fileStore;
this.fileRepositoryCollectionFactory = fileRepositoryCollectionFactory;
this.importRunService = importRunService;
this.groupAuthorityFactory = requireNonNull(groupAuthorityFactory);
this.dataService = dataService;
this.asyncImportJobs = Executors.newSingleThreadExecutor();
}
开发者ID:molgenis,项目名称:molgenis,代码行数:34,代码来源:ImportWizardController.java
示例6: setAuthoritiesMapper
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; //导入依赖的package包/类
public void setAuthoritiesMapper(GrantedAuthoritiesMapper authoritiesMapper) {
this.authoritiesMapper = authoritiesMapper;
}
开发者ID:evoila,项目名称:cfsummiteu2017,代码行数:4,代码来源:UaaRelyingPartyAuthenticationProvider.java
示例7: setGrantedAuthoritiesMapper
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; //导入依赖的package包/类
@Override
public void setGrantedAuthoritiesMapper(GrantedAuthoritiesMapper grantedAuthoritiesMapper) {
this.grantedAuthoritiesMapper = grantedAuthoritiesMapper;
}
开发者ID:MaritimeConnectivityPlatform,项目名称:IdentityRegistry,代码行数:5,代码来源:MCKeycloakAuthenticationProvider.java
示例8: PermissionManagerServiceImpl
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; //导入依赖的package包/类
public PermissionManagerServiceImpl(DataService dataService, GrantedAuthoritiesMapper grantedAuthoritiesMapper)
{
this.dataService = requireNonNull(dataService);
this.grantedAuthoritiesMapper = requireNonNull(grantedAuthoritiesMapper);
}
开发者ID:molgenis,项目名称:molgenis,代码行数:6,代码来源:PermissionManagerServiceImpl.java
示例9: UserDetailsService
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; //导入依赖的package包/类
public UserDetailsService(DataService dataService, GrantedAuthoritiesMapper grantedAuthoritiesMapper)
{
this.dataService = requireNonNull(dataService, "DataService is null");
this.grantedAuthoritiesMapper = requireNonNull(grantedAuthoritiesMapper, "Granted authorities mapper is null");
}
开发者ID:molgenis,项目名称:molgenis,代码行数:6,代码来源:UserDetailsService.java
示例10: roleHierarchyAuthoritiesMapper
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; //导入依赖的package包/类
@Bean
public GrantedAuthoritiesMapper roleHierarchyAuthoritiesMapper()
{
return new RoleHierarchyAuthoritiesMapper(roleHierarchy());
}
开发者ID:molgenis,项目名称:molgenis,代码行数:6,代码来源:MolgenisWebAppSecurityConfig.java
示例11: grantedAuthoritiesMapper
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; //导入依赖的package包/类
@Bean
public GrantedAuthoritiesMapper grantedAuthoritiesMapper()
{
return mock(GrantedAuthoritiesMapper.class);
}
开发者ID:molgenis,项目名称:molgenis,代码行数:6,代码来源:PermissionManagerServiceImplTest.java
示例12: setGrantedAuthoritiesMapper
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; //导入依赖的package包/类
/**
* Set the optional {@link GrantedAuthoritiesMapper} for this {@link AuthenticationProvider}.
*
* @param grantedAuthoritiesMapper the <code>GrantedAuthoritiesMapper</code> to use
*/
public void setGrantedAuthoritiesMapper(GrantedAuthoritiesMapper grantedAuthoritiesMapper) {
this.grantedAuthoritiesMapper = grantedAuthoritiesMapper;
}
开发者ID:Smartling,项目名称:smartling-keycloak-extras,代码行数:9,代码来源:DirectAccessGrantAuthenticationProvider.java
注:本文中的org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论