當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。