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


Java SimpleServiceIdentityProvider.getIdentity方法代码示例

本文整理汇总了Java中com.yahoo.athenz.auth.impl.SimpleServiceIdentityProvider.getIdentity方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleServiceIdentityProvider.getIdentity方法的具体用法?Java SimpleServiceIdentityProvider.getIdentity怎么用?Java SimpleServiceIdentityProvider.getIdentity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.yahoo.athenz.auth.impl.SimpleServiceIdentityProvider的用法示例。


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

示例1: createServicePrincipal

import com.yahoo.athenz.auth.impl.SimpleServiceIdentityProvider; //导入方法依赖的package包/类
private Principal createServicePrincipal() {
    AthenzConfig.Service service = config.service();
    // TODO bjorncs: Cache principal token
    SimpleServiceIdentityProvider identityProvider =
            new SimpleServiceIdentityProvider(
                    athenzPrincipalAuthority,
                    config.domain(),
                    service.name(),
                    getServicePrivateKey(),
                    service.publicKeyId(),
                    Duration.ofMinutes(service.credentialsExpiryMinutes()).getSeconds());
    return identityProvider.getIdentity(config.domain(), service.name());
}
 
开发者ID:vespa-engine,项目名称:vespa,代码行数:14,代码来源:AthenzClientFactoryImpl.java

示例2: testSimpleIdentityDefaultV0

import com.yahoo.athenz.auth.impl.SimpleServiceIdentityProvider; //导入方法依赖的package包/类
@Test
public void testSimpleIdentityDefaultV0() {
    
    SimpleServiceIdentityProvider provider = new SimpleServiceIdentityProvider("coretech",
            "athenz", Crypto.loadPrivateKey(k0File), "0");
    Principal user = provider.getIdentity("coretech", "athenz");
    assertNotNull(user);
    assertTrue(user.getIssueTime() != 0);
    
    String token = user.getCredentials();
    PrincipalToken prToken = new PrincipalToken(token);
    assertTrue(prToken.validate(servicePublicKeyStringK0, 0, false));
    assertEquals(prToken.getKeyId(), "0");
}
 
开发者ID:yahoo,项目名称:athenz,代码行数:15,代码来源:SimpleServiceIdentityProviderTest.java

示例3: testSimpleIdentityDefaultV1

import com.yahoo.athenz.auth.impl.SimpleServiceIdentityProvider; //导入方法依赖的package包/类
@Test
public void testSimpleIdentityDefaultV1() {
    
    PrivateKey key = Crypto.loadPrivateKey(servicePrivateKeyStringK1);
    SimpleServiceIdentityProvider provider = new SimpleServiceIdentityProvider("coretech",
            "athenz", key, "1");
    Principal user = provider.getIdentity("coretech", "athenz");
    assertNotNull(user);
    assertTrue(user.getIssueTime() != 0);
    
    String token = user.getCredentials();
    PrincipalToken prToken = new PrincipalToken(token);
    assertTrue(prToken.validate(servicePublicKeyStringK1, 0, false));
    assertEquals(prToken.getKeyId(), "1");
}
 
开发者ID:yahoo,项目名称:athenz,代码行数:16,代码来源:SimpleServiceIdentityProviderTest.java

示例4: testSimpleIdentityPrivateKeyDomainMismatch

import com.yahoo.athenz.auth.impl.SimpleServiceIdentityProvider; //导入方法依赖的package包/类
@Test
public void testSimpleIdentityPrivateKeyDomainMismatch() {

    PrivateKey key = Crypto.loadPrivateKey(servicePrivateKeyStringK1);
    SimpleServiceIdentityProvider provider = new SimpleServiceIdentityProvider("coretech",
            "athenz", key, "1");
    
    Principal user = provider.getIdentity("coretech2", "athenz");
    assertNull(user);

    user = provider.getIdentity("coretech", "athenz2");
    assertNull(user);
}
 
开发者ID:yahoo,项目名称:athenz,代码行数:14,代码来源:SimpleServiceIdentityProviderTest.java

示例5: testGetServicePrincipal

import com.yahoo.athenz.auth.impl.SimpleServiceIdentityProvider; //导入方法依赖的package包/类
@Test
public void testGetServicePrincipal() {
    
    PrivateKey privateKey = Crypto.loadPrivateKey(Crypto.ybase64DecodeString(privKey));
    SimpleServiceIdentityProvider provider = new SimpleServiceIdentityProvider("coretech",
            "storage", privateKey, "0");
    
    Principal testPrincipal = provider.getIdentity("coretech", "storage");
    assertNotNull(testPrincipal);
    ResourceContext rsrcCtxTest = createResourceContext(testPrincipal);
    ServicePrincipal principal = zms.getServicePrincipal(rsrcCtxTest);
    assertNotNull(principal);
    assertTrue(principal.getService().equals("storage"));
    assertTrue(principal.getDomain().equals("coretech"));
}
 
开发者ID:yahoo,项目名称:athenz,代码行数:16,代码来源:ZMSImplTest.java


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