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


Java EntityType.Combined方法代码示例

本文整理汇总了Java中com.hp.autonomy.hod.client.api.authentication.EntityType.Combined方法的典型用法代码示例。如果您正苦于以下问题:Java EntityType.Combined方法的具体用法?Java EntityType.Combined怎么用?Java EntityType.Combined使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.autonomy.hod.client.api.authentication.EntityType的用法示例。


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

示例1: testUpdateThrowsIllegalArgumentExceptionForExpiredTokens

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testUpdateThrowsIllegalArgumentExceptionForExpiredTokens() throws IOException {
    final AuthenticationToken<EntityType.Combined, TokenType.Simple> token1 = mockToken(false);
    final AuthenticationToken<EntityType.Combined, TokenType.Simple> token2 = mockToken(true);
    when(token2.hasExpired()).thenReturn(true);

    TokenProxy<EntityType.Combined, TokenType.Simple> key = null;

    try {
        key = tokenRepository.insert(token1);
    } catch (final IllegalArgumentException e) {
        fail("The initial token should not have expired");
    }

    tokenRepository.update(key, token2);
}
 
开发者ID:hpe-idol,项目名称:java-hod-client,代码行数:17,代码来源:InMemoryTokenRepositoryTest.java

示例2: deserializes

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Test
public void deserializes() throws IOException, ClassNotFoundException {
    final HodAuthentication<EntityType.Combined> deserializedAuthentication = deserializeFromResource("serializedHodAuthentication.ser");
    assertThat(deserializedAuthentication.getTokenProxy(), not(nullValue()));

    final Collection<GrantedAuthority> authorities = deserializedAuthentication.getAuthorities();
    assertThat(authorities, contains(GRANTED_AUTHORITY));

    final HodAuthenticationPrincipal principal = deserializedAuthentication.getPrincipal();
    assertThat(principal.getTenantUuid(), is(TENANT_UUID));
    assertThat(principal.getUserUuid(), is(USER_UUID));
    assertThat(principal.getApplication(), is(APPLICATION));
    assertThat(principal.getUserStoreInformation(), is(USER_STORE));
    assertThat(principal.getApplicationAuthentication(), is(APP_AUTHENTICATION));
    assertThat(principal.getUserAuthentication(), is(USER_AUTHENTICATION));
    assertThat(principal.getUserMetadata(), is(METADATA));
    assertThat(principal.getName(), is(NAME));
}
 
开发者ID:hpe-idol,项目名称:java-hod-sso-spring-security,代码行数:19,代码来源:HodAuthenticationTest.java

示例3: authenticatesWithRole

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Test
public void authenticatesWithRole() throws HodErrorException, IOException {
    final HodAuthenticationProvider provider = createSimpleProvider();
    final Authentication tokenAuthentication = new HodTokenAuthentication<>(combinedSsoToken);

    @SuppressWarnings("unchecked")
    final HodAuthentication<EntityType.Combined> authentication = (HodAuthentication<EntityType.Combined>) provider.authenticate(tokenAuthentication);

    verify(tokenRepository, times(1)).insert(combinedToken);

    assertThat(authentication.getTokenProxy(), is(tokenProxy));

    final HodAuthenticationPrincipal principal = authentication.getPrincipal();

    assertThat(principal.getApplication().getName(), is(APPLICATION_NAME));
    assertThat(principal.getUserUuid(), is(USER_UUID));
    assertThat(principal.getUserMetadata().size(), is(0));

    final Collection<GrantedAuthority> authorities = authentication.getAuthorities();

    assertThat(authorities, containsInAnyOrder(
            new SimpleGrantedAuthority(USER_ROLE),
            new HodApplicationGrantedAuthority(new ResourceName(APPLICATION_DOMAIN, APPLICATION_NAME))
    ));
}
 
开发者ID:hpe-idol,项目名称:java-hod-sso-spring-security,代码行数:26,代码来源:HodAuthenticationProviderTest.java

示例4: setUp

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Before
public void setUp() throws IOException {
    tokenProxy = new TokenProxy<>(EntityType.Combined.INSTANCE, TokenType.Simple.INSTANCE);

    final AuthenticationToken<EntityType.Combined, TokenType.Simple> token = new AuthenticationToken<>(
            EntityType.Combined.INSTANCE,
            TokenType.Simple.INSTANCE,
            DateTime.now().plus(standardHours(2)),
            "token-id",
            "token-secret",
            DateTime.now().plus(standardHours(1))
    );

    final TokenRepository tokenRepository = mock(TokenRepository.class);
    when(tokenRepository.get(tokenProxy)).thenReturn(token);

    logoutSuccessHandler = new HodTokenLogoutSuccessHandler(REDIRECT_PATH, tokenRepository);
}
 
开发者ID:hpe-idol,项目名称:java-hod-sso-spring-security,代码行数:19,代码来源:HodTokenLogoutSuccessHandlerTest.java

示例5: authenticationInformationRetriever

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Bean
@ConditionalOnMissingBean(AuthenticationInformationRetriever.class)
public AuthenticationInformationRetriever<HodAuthentication<EntityType.Combined>, HodAuthenticationPrincipal> authenticationInformationRetriever() {
    @SuppressWarnings("unchecked")
    final AuthenticationInformationRetriever<HodAuthentication<EntityType.Combined>, HodAuthenticationPrincipal> retriever =
            new SpringSecurityAuthenticationInformationRetriever<>((Class<HodAuthentication<EntityType.Combined>>) (Class<?>) HodAuthentication.class, HodAuthenticationPrincipal.class);
    return retriever;
}
 
开发者ID:hpe-idol,项目名称:haven-search-components,代码行数:9,代码来源:HodAuthenticationConfiguration.java

示例6: hodServiceConfig

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Bean
@ConditionalOnMissingBean(HodServiceConfig.class)
public HodServiceConfig<EntityType.Combined, TokenType.Simple> hodServiceConfig(
        final TokenProxyService<EntityType.Combined, TokenType.Simple> tokenProxyService,
        final HttpClient httpClient,
        final TokenRepository tokenRepository,
        final ObjectMapper objectMapper
) {
    return new HodServiceConfig.Builder<EntityType.Combined, TokenType.Simple>(HOD_URL)
            .setTokenProxyService(tokenProxyService)
            .setHttpClient(httpClient)
            .setTokenRepository(tokenRepository)
            .setObjectMapper(objectMapper)
            .build();
}
 
开发者ID:hpe-idol,项目名称:haven-search-components,代码行数:16,代码来源:HodTestConfiguration.java

示例7: multipleTokenTypes

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Test
public void multipleTokenTypes() throws IOException {
    final AuthenticationToken<EntityType.Combined, TokenType.Simple> combinedToken = new AuthenticationToken<>(
        EntityType.Combined.INSTANCE,
        TokenType.Simple.INSTANCE,
        getExpiry(),
        "combined-id",
        "combined-secret",
        getRefresh()
    );

    final AuthenticationToken<EntityType.Developer, TokenType.HmacSha1> developerToken = new AuthenticationToken<>(
        EntityType.Developer.INSTANCE,
        TokenType.HmacSha1.INSTANCE,
        getExpiry(),
        "developer-id",
        "developer-secret",
        getRefresh()
    );

    final TokenProxy<EntityType.Combined, TokenType.Simple> combinedTokenProxy = tokenRepository.insert(combinedToken);
    final TokenProxy<EntityType.Developer, TokenType.HmacSha1> developerTokenProxy = tokenRepository.insert(developerToken);

    final AuthenticationToken<EntityType.Combined, TokenType.Simple> outputCombinedToken = tokenRepository.get(combinedTokenProxy);
    final AuthenticationToken<EntityType.Developer, TokenType.HmacSha1> outputDeveloperToken = tokenRepository.get(developerTokenProxy);

    assertThat(outputDeveloperToken, is(developerToken));
    assertThat(outputCombinedToken, is(combinedToken));
}
 
开发者ID:hpe-idol,项目名称:redis-hod-token-repository,代码行数:30,代码来源:RedisTokenRepositoryITCase.java

示例8: testUpdate

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Test
public void testUpdate() {
    final AuthenticationToken<EntityType.Combined, TokenType.Simple> token = mockToken(false);

    final TokenProxy<EntityType.Combined, TokenType.Simple> key = tokenRepository.insert(token);

    final AuthenticationToken<EntityType.Combined, TokenType.Simple> newToken = mockToken(false);
    tokenRepository.update(key, newToken);

    assertThat(tokenRepository.get(key), is(newToken));
}
 
开发者ID:hpe-idol,项目名称:java-hod-client,代码行数:12,代码来源:InMemoryTokenRepositoryTest.java

示例9: testUpdateReturnsNullAndDoesNothingIfKeyNotPresent

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Test
public void testUpdateReturnsNullAndDoesNothingIfKeyNotPresent() {
    final TokenProxy<EntityType.Combined, TokenType.Simple> key = new TokenProxy<>(EntityType.Combined.INSTANCE, TokenType.Simple.INSTANCE);
    final AuthenticationToken<EntityType.Combined, TokenType.Simple> oldToken = tokenRepository.update(key, mockToken(false));

    assertThat(oldToken, is(nullValue()));
    assertThat(tokenRepository.get(key), is(nullValue()));
}
 
开发者ID:hpe-idol,项目名称:java-hod-client,代码行数:9,代码来源:InMemoryTokenRepositoryTest.java

示例10: testRemove

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Test
public void testRemove() {
    final AuthenticationToken<EntityType.Combined, TokenType.Simple> token = mockToken(false);
    final TokenProxy<EntityType.Combined, TokenType.Simple> key = tokenRepository.insert(token);

    assertThat(tokenRepository.remove(key), is(token));
    assertThat(tokenRepository.get(key), is(nullValue()));
}
 
开发者ID:hpe-idol,项目名称:java-hod-client,代码行数:9,代码来源:InMemoryTokenRepositoryTest.java

示例11: mockToken

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
private AuthenticationToken<EntityType.Combined, TokenType.Simple> mockToken(final boolean expired) {
    @SuppressWarnings("unchecked")
    final AuthenticationToken<EntityType.Combined, TokenType.Simple> token = mock(AuthenticationToken.class);

    when(token.hasExpired()).thenReturn(expired);
    when(token.getEntityType()).thenReturn(EntityType.Combined.INSTANCE);
    when(token.getTokenType()).thenReturn(TokenType.Simple.INSTANCE);

    return token;
}
 
开发者ID:hpe-idol,项目名称:java-hod-client,代码行数:11,代码来源:InMemoryTokenRepositoryTest.java

示例12: resolveAuthorities

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Override
public Collection<GrantedAuthority> resolveAuthorities(
        final TokenProxy<EntityType.Combined, TokenType.Simple> tokenProxy,
        final CombinedTokenInformation combinedTokenInformation
) {
    final Collection<GrantedAuthority> output = new LinkedList<>();

    for (final String authority : authorities) {
        output.add(new SimpleGrantedAuthority(authority));
    }

    return output;
}
 
开发者ID:hpe-idol,项目名称:java-hod-sso-spring-security,代码行数:14,代码来源:ConstantAuthoritiesResolver.java

示例13: onLogoutSuccess

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Override
public void onLogoutSuccess(final HttpServletRequest request, final HttpServletResponse response, final Authentication authentication) throws IOException, ServletException {
    String redirectUrl = redirectPath;

    if (authentication instanceof HodAuthentication) {
        // Usage of this class requires that application authentications are HodAuthentication<Combined>.
        @SuppressWarnings("unchecked")
        final HodAuthentication<EntityType.Combined> hodAuthentication = (HodAuthentication<EntityType.Combined>) authentication;

        final AuthenticationToken<EntityType.Combined, TokenType.Simple> combinedToken = tokenRepository.get(hodAuthentication.getTokenProxy());
        redirectUrl += "?token=" + uriEncode(combinedToken.toString());
    }

    redirectStrategy.sendRedirect(request, response, redirectUrl);
}
 
开发者ID:hpe-idol,项目名称:java-hod-sso-spring-security,代码行数:16,代码来源:HodTokenLogoutSuccessHandler.java

示例14: retrieveMetadata

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
private HodUserMetadata retrieveMetadata (
        final TokenProxy<EntityType.Combined, TokenType.Simple> combinedTokenProxy,
        final CombinedTokenInformation combinedTokenInformation,
        final ResourceIdentifier userStore
) throws HodErrorException {
    return userStoreUsersService == null ?
            new HodUserMetadata("", Collections.emptyMap()) :
            hodUserMetadataResolver.resolve(userStoreUsersService.getUserMetadata(combinedTokenProxy, userStore, combinedTokenInformation.getUser().getUuid()));
}
 
开发者ID:hpe-idol,项目名称:java-hod-sso-spring-security,代码行数:10,代码来源:CookieHodAuthenticationProvider.java

示例15: serializesAndDeserializes

import com.hp.autonomy.hod.client.api.authentication.EntityType; //导入方法依赖的package包/类
@Test
public void serializesAndDeserializes() throws IOException, ClassNotFoundException {
    final HodAuthentication<EntityType.Combined> authentication = new HodAuthentication<>(
            new TokenProxy<>(EntityType.Combined.INSTANCE, TokenType.Simple.INSTANCE),
            Collections.singleton(GRANTED_AUTHORITY),
            PRINCIPAL
    );

    final HodAuthentication<EntityType.Combined> outputAuthentication = writeAndReadObject(authentication);
    assertThat(outputAuthentication, is(authentication));
}
 
开发者ID:hpe-idol,项目名称:java-hod-sso-spring-security,代码行数:12,代码来源:HodAuthenticationTest.java


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