Skip to content

Commit

Permalink
- rename method (Azure#18163)
Browse files Browse the repository at this point in the history
  • Loading branch information
backwind1233 authored Dec 16, 2020
1 parent 9346994 commit 879fde7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public <T extends OAuth2AuthorizedClient> T loadAuthorizedClient(String id,
return (T) result;
}

if (repo.isAuthzClient(id)) {
if (repo.isClientNeedConsentWhenLogin(id)) {
OAuth2AuthorizedClient client = loadAuthorizedClient(defaultClientRegistrationId(), principal, request);
return (T) createInitAuthzClient(client, id, principal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ public AzureClientRegistration getAzureClient() {
return azureClient;
}

public boolean isAuthzClient(ClientRegistration client) {
public boolean isClientNeedConsentWhenLogin(ClientRegistration client) {
return otherClients.contains(client)
&& properties.getAuthorization().get(client.getClientName()) != null
&& !properties.getAuthorization().get(client.getClientName()).isOnDemand();
}

public boolean isAuthzClient(String id) {
public boolean isClientNeedConsentWhenLogin(String id) {
ClientRegistration client = findByRegistrationId(id);
return client != null && isAuthzClient(client);
return client != null && isClientNeedConsentWhenLogin(client);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ public void aadAwareClientRepository() {
);
assertEquals(clientRepo.getAzureClient().getClient(), azure);

assertFalse(clientRepo.isAuthzClient(azure));
assertTrue(clientRepo.isAuthzClient(graph));
assertFalse(clientRepo.isAuthzClient("azure"));
assertTrue(clientRepo.isAuthzClient("graph"));
assertFalse(clientRepo.isClientNeedConsentWhenLogin(azure));
assertTrue(clientRepo.isClientNeedConsentWhenLogin(graph));
assertFalse(clientRepo.isClientNeedConsentWhenLogin("azure"));
assertTrue(clientRepo.isClientNeedConsentWhenLogin("graph"));

List<ClientRegistration> clients = collectClients(clientRepo);
assertEquals(2, clients.size());
Expand Down Expand Up @@ -217,10 +217,10 @@ public void clientRequiresOnDemandPermissions() {
"offline_access",
"https://management.core.windows.net/user_impersonation");

assertFalse(repo.isAuthzClient(graph));
assertTrue(repo.isAuthzClient(arm));
assertFalse(repo.isAuthzClient("graph"));
assertTrue(repo.isAuthzClient("arm"));
assertFalse(repo.isClientNeedConsentWhenLogin(graph));
assertTrue(repo.isClientNeedConsentWhenLogin(arm));
assertFalse(repo.isClientNeedConsentWhenLogin("graph"));
assertTrue(repo.isClientNeedConsentWhenLogin("arm"));
});
}

Expand Down

0 comments on commit 879fde7

Please sign in to comment.