Skip to content

Commit

Permalink
Get the tenant identity from the data domain identity, not the api ke…
Browse files Browse the repository at this point in the history
…y payload.
  • Loading branch information
piotrczarnas committed Feb 4, 2024
1 parent d02aaf5 commit c153817
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public String getLookerStudioQueryApiKey(DqoUserPrincipal userPrincipal) {

LookerStudioKeyRequestApi lookerStudioKeyRequestApi = new LookerStudioKeyRequestApi(authenticatedClient);
String queryApiKey = lookerStudioKeyRequestApi.issueLookerStudioApiKey(userPrincipal.getDataDomainIdentity().getDataDomainCloud(),
userPrincipal.getApiKeyPayload().getSubject(), userPrincipal.getApiKeyPayload().getTenantId());
userPrincipal.getDataDomainIdentity().getTenantOwner(), userPrincipal.getDataDomainIdentity().getTenantId());

synchronized (this.lock) {
DqoCloudApiKey decodedApiKey = this.dqoCloudApiKeyProvider.decodeApiKey(queryApiKey);
Expand Down Expand Up @@ -128,7 +128,7 @@ public TenantQueryAccessTokenModel getLookerStudioAccessToken(DqoUserPrincipal u
apiClient.getAuthentication("api_key");
AccessTokenIssueApi accessTokenIssueApi = new AccessTokenIssueApi(apiClient);
TenantQueryAccessTokenModel tenantQueryAccessTokenModel = accessTokenIssueApi.issueTenantDataROQueryAccessToken(
userPrincipal.getApiKeyPayload().getSubject(), userPrincipal.getApiKeyPayload().getTenantId());
userPrincipal.getDataDomainIdentity().getTenantOwner(), userPrincipal.getDataDomainIdentity().getTenantId());

Instant expiresAt = Instant.now().plus(1, ChronoUnit.HOURS);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public String getTicketGrantingTicket() {
ticketGrantingTicketRequest.setUrl(returnBaseUrl);

String signedTicketGrantingTicket = refreshTokenIssueApi.issueLoginTicketGrantingTicketToken(ticketGrantingTicketRequest,
userPrincipalForAdministrator.getApiKeyPayload().getSubject(), userPrincipalForAdministrator.getApiKeyPayload().getTenantId());
userPrincipalForAdministrator.getDataDomainIdentity().getTenantOwner(), userPrincipalForAdministrator.getDataDomainIdentity().getTenantId());
this.grantingTicketPayloadSignedObject = this.signatureService.decodeSignedMessageHexNoValidate(
UserLoginTicketGrantingTicketPayload.class, signedTicketGrantingTicket);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Collection<DqoCloudUserModel> listUsers(DqoUserPrincipal userPrincipal) {

AccountUsersApi accountUsersApi = new AccountUsersApi(authenticatedClient);
List<DqoUserModel> cloudUserList = accountUsersApi.listAccountUsers(
userPrincipal.getApiKeyPayload().getSubject(), userPrincipal.getApiKeyPayload().getTenantId());
userPrincipal.getDataDomainIdentity().getTenantOwner(), userPrincipal.getDataDomainIdentity().getTenantId());

List<DqoCloudUserModel> users =
cloudUserList.stream()
Expand Down Expand Up @@ -107,7 +107,7 @@ public DqoCloudUserModel getUserByEmail(DqoUserPrincipal userPrincipal, String e

AccountUsersApi accountUsersApi = new AccountUsersApi(authenticatedClient);
DqoUserModel cloudUserModel = accountUsersApi.getAccountUser(email,
userPrincipal.getApiKeyPayload().getSubject(), userPrincipal.getApiKeyPayload().getTenantId());
userPrincipal.getDataDomainIdentity().getTenantOwner(), userPrincipal.getDataDomainIdentity().getTenantId());

DqoCloudUserModel dqoCloudUserModel = new DqoCloudUserModel() {{
setEmail(cloudUserModel.getEmail());
Expand Down Expand Up @@ -153,7 +153,7 @@ public void createUser(DqoUserPrincipal userPrincipal, DqoCloudUserModel userMod
}};

accountUsersApi.createAccountUser(dqoUserModel,
userPrincipal.getApiKeyPayload().getSubject(), userPrincipal.getApiKeyPayload().getTenantId());
userPrincipal.getDataDomainIdentity().getTenantOwner(), userPrincipal.getDataDomainIdentity().getTenantId());
}
catch (DqoCloudInvalidKeyException ex) {
throw ex;
Expand Down Expand Up @@ -193,7 +193,7 @@ public void updateUser(DqoUserPrincipal userPrincipal, DqoCloudUserModel userMod
}};

accountUsersApi.updateAccountUser(userModel.getEmail(), dqoUserModel,
userPrincipal.getApiKeyPayload().getSubject(), userPrincipal.getApiKeyPayload().getTenantId());
userPrincipal.getDataDomainIdentity().getTenantOwner(), userPrincipal.getDataDomainIdentity().getTenantId());
}
catch (DqoCloudInvalidKeyException ex) {
throw ex;
Expand Down Expand Up @@ -228,7 +228,7 @@ public void deleteUser(DqoUserPrincipal userPrincipal, String email) {

AccountUsersApi accountUsersApi = new AccountUsersApi(authenticatedClient);
accountUsersApi.deleteAccountUser(email,
userPrincipal.getApiKeyPayload().getSubject(), userPrincipal.getApiKeyPayload().getTenantId());
userPrincipal.getDataDomainIdentity().getTenantOwner(), userPrincipal.getDataDomainIdentity().getTenantId());
}
catch (DqoCloudInvalidKeyException ex) {
throw ex;
Expand Down Expand Up @@ -267,7 +267,7 @@ public void changePassword(DqoUserPrincipal userPrincipal, String email, String

AccountUsersApi accountUsersApi = new AccountUsersApi(authenticatedClient);
accountUsersApi.changeAccountUserPassword(email, newPassword,
userPrincipal.getApiKeyPayload().getSubject(), userPrincipal.getApiKeyPayload().getTenantId());
userPrincipal.getDataDomainIdentity().getTenantOwner(), userPrincipal.getDataDomainIdentity().getTenantId());
}
catch (DqoCloudInvalidKeyException ex) {
throw ex;
Expand Down

0 comments on commit c153817

Please sign in to comment.