congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
OAuth2AuthorizedClientArgumentResolver.setClientCredentialsTokenResponseClient
Code IndexAdd Tabnine to your IDE (free)

How to use
setClientCredentialsTokenResponseClient
method
in
org.springframework.security.oauth2.client.web.method.annotation.OAuth2AuthorizedClientArgumentResolver

Best Java code snippets using org.springframework.security.oauth2.client.web.method.annotation.OAuth2AuthorizedClientArgumentResolver.setClientCredentialsTokenResponseClient (Showing top 2 results out of 315)

origin: spring-projects/spring-security

@Test
public void setClientCredentialsTokenResponseClientWhenClientIsNullThenThrowIllegalArgumentException() {
  assertThatThrownBy(() -> this.argumentResolver.setClientCredentialsTokenResponseClient(null))
      .isInstanceOf(IllegalArgumentException.class);
}
origin: spring-projects/spring-security

@SuppressWarnings("unchecked")
@Test
public void resolveArgumentWhenAuthorizedClientNotFoundForClientCredentialsClientThenResolvesFromTokenResponseClient() throws Exception {
  OAuth2AccessTokenResponseClient<OAuth2ClientCredentialsGrantRequest> clientCredentialsTokenResponseClient =
      mock(OAuth2AccessTokenResponseClient.class);
  this.argumentResolver.setClientCredentialsTokenResponseClient(clientCredentialsTokenResponseClient);
  OAuth2AccessTokenResponse accessTokenResponse = OAuth2AccessTokenResponse
      .withToken("access-token-1234")
      .tokenType(OAuth2AccessToken.TokenType.BEARER)
      .expiresIn(3600)
      .build();
  when(clientCredentialsTokenResponseClient.getTokenResponse(any())).thenReturn(accessTokenResponse);
  when(this.authorizedClientRepository.loadAuthorizedClient(anyString(), any(), any(HttpServletRequest.class)))
      .thenReturn(null);
  MethodParameter methodParameter = this.getMethodParameter("clientCredentialsClient", OAuth2AuthorizedClient.class);
  OAuth2AuthorizedClient authorizedClient = (OAuth2AuthorizedClient) this.argumentResolver.resolveArgument(
      methodParameter, null, new ServletWebRequest(this.request), null);
  assertThat(authorizedClient).isNotNull();
  assertThat(authorizedClient.getClientRegistration()).isSameAs(this.registration2);
  assertThat(authorizedClient.getPrincipalName()).isEqualTo(this.principalName);
  assertThat(authorizedClient.getAccessToken()).isSameAs(accessTokenResponse.getAccessToken());
  verify(this.authorizedClientRepository).saveAuthorizedClient(
      eq(authorizedClient), eq(this.authentication), any(HttpServletRequest.class), eq(null));
}
org.springframework.security.oauth2.client.web.method.annotationOAuth2AuthorizedClientArgumentResolversetClientCredentialsTokenResponseClient

Javadoc

Sets the client used when requesting an access token credential at the Token Endpoint for the client_credentials grant.

Popular methods of OAuth2AuthorizedClientArgumentResolver

  • <init>
  • authorizeClientCredentialsClient
  • resolveClientRegistrationId
  • resolveArgument
  • supportsParameter

Popular in Java

  • Reactive rest calls using spring rest template
  • notifyDataSetChanged (ArrayAdapter)
  • setContentView (Activity)
  • runOnUiThread (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • JLabel (javax.swing)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now