@Test public void setOauth2UserServiceWhenNullThenThrowIllegalArgumentException() { assertThatThrownBy(() -> this.userService.setOauth2UserService(null)) .isInstanceOf(IllegalArgumentException.class); }
@Before public void setup() throws Exception { this.server = new MockWebServer(); this.server.start(); this.clientRegistrationBuilder = clientRegistration() .userInfoUri(null) .userInfoAuthenticationMethod(AuthenticationMethod.HEADER) .userNameAttributeName(StandardClaimNames.SUB); this.accessToken = scopes(OidcScopes.OPENID, OidcScopes.PROFILE); Map<String, Object> idTokenClaims = new HashMap<>(); idTokenClaims.put(IdTokenClaimNames.ISS, "https://provider.com"); idTokenClaims.put(IdTokenClaimNames.SUB, "subject1"); this.idToken = new OidcIdToken("access-token", Instant.MIN, Instant.MAX, idTokenClaims); this.userService.setOauth2UserService(new DefaultOAuth2UserService()); }