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);
}
Aggregations