Search in sources :

Example 6 with ZMSClient

use of com.yahoo.athenz.zms.ZMSClient in project vespa by vespa-engine.

the class AthenzClientFactoryImpl method createZmsClientWithAuthorizedServiceToken.

/**
 * @return A ZMS client created with a dual principal representing both the tenant admin and the service identity.
 */
@Override
public ZmsClient createZmsClientWithAuthorizedServiceToken(NToken authorizedServiceToken) {
    PrincipalToken signedToken = new PrincipalToken(authorizedServiceToken.getRawToken());
    AthenzConfig.Service service = config.service();
    signedToken.signForAuthorizedService(config.domain() + "." + service.name(), service.publicKeyId(), getServicePrivateKey());
    Principal dualPrincipal = SimplePrincipal.create(AthenzIdentities.USER_PRINCIPAL_DOMAIN.getName(), signedToken.getName(), signedToken.getSignedToken(), athenzPrincipalAuthority);
    return new ZmsClientImpl(new ZMSClient(config.legacyZmsUrl(), dualPrincipal), config);
}
Also used : AthenzConfig(com.yahoo.vespa.hosted.controller.athenz.config.AthenzConfig) PrincipalToken(com.yahoo.athenz.auth.token.PrincipalToken) ZMSClient(com.yahoo.athenz.zms.ZMSClient) SimplePrincipal(com.yahoo.athenz.auth.impl.SimplePrincipal) Principal(com.yahoo.athenz.auth.Principal)

Aggregations

ZMSClient (com.yahoo.athenz.zms.ZMSClient)6 SignedDomain (com.yahoo.athenz.zms.SignedDomain)3 SignedDomains (com.yahoo.athenz.zms.SignedDomains)3 ArrayList (java.util.ArrayList)3 Principal (com.yahoo.athenz.auth.Principal)2 SimplePrincipal (com.yahoo.athenz.auth.impl.SimplePrincipal)2 PrincipalToken (com.yahoo.athenz.auth.token.PrincipalToken)2 DomainData (com.yahoo.athenz.zms.DomainData)2 ZMSClientException (com.yahoo.athenz.zms.ZMSClientException)2 ZMSFileChangeLogStore (com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore)2 Test (org.testng.annotations.Test)2 KeyRefresher (com.oath.auth.KeyRefresher)1 Access (com.yahoo.athenz.zms.Access)1 AthenzConfig (com.yahoo.vespa.hosted.controller.athenz.config.AthenzConfig)1 HashMap (java.util.HashMap)1 List (java.util.List)1 SSLContext (javax.net.ssl.SSLContext)1 CommandLine (org.apache.commons.cli.CommandLine)1 ParseException (org.apache.commons.cli.ParseException)1