- Common ways to obtain AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository
private void myMethod () {AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository a =
ReactiveOAuth2AuthorizedClientService authorizedClientService;new AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository(authorizedClientService)
- Smart code suggestions by Codota
}
@Test public void loadAuthorizedClientWhenAnonymousPrincipalThenLoadFromAnonymousRepository() { when(this.anonymousAuthorizedClientRepository.loadAuthorizedClient(any(), any(), any())).thenReturn(Mono.empty()); Authentication authentication = this.createAnonymousPrincipal(); this.authorizedClientRepository.loadAuthorizedClient(this.registrationId, authentication, this.exchange).block(); verify(this.anonymousAuthorizedClientRepository).loadAuthorizedClient(this.registrationId, authentication, this.exchange); }
@Test public void loadAuthorizedClientWhenAuthenticatedPrincipalThenLoadFromService() { when(this.authorizedClientService.loadAuthorizedClient(any(), any())).thenReturn(Mono.empty()); Authentication authentication = this.createAuthenticatedPrincipal(); this.authorizedClientRepository.loadAuthorizedClient(this.registrationId, authentication, this.exchange).block(); verify(this.authorizedClientService).loadAuthorizedClient(this.registrationId, this.principalName); }