congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
OAuth2AuthorizationRequestRedirectWebFilter.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.springframework.security.oauth2.client.web.server.OAuth2AuthorizationRequestRedirectWebFilter
constructor

Best Java code snippets using org.springframework.security.oauth2.client.web.server.OAuth2AuthorizationRequestRedirectWebFilter.<init> (Showing top 8 results out of 315)

origin: spring-projects/spring-security

private OAuth2AuthorizationRequestRedirectWebFilter getRedirectWebFilter() {
  OAuth2AuthorizationRequestRedirectWebFilter oauthRedirectFilter;
  if (this.authorizationRequestResolver == null) {
    oauthRedirectFilter = new OAuth2AuthorizationRequestRedirectWebFilter(getClientRegistrationRepository());
  } else {
    oauthRedirectFilter = new OAuth2AuthorizationRequestRedirectWebFilter(this.authorizationRequestResolver);
  }
  return oauthRedirectFilter;
}
origin: spring-projects/spring-security

@Test
public void constructorWhenClientRegistrationRepositoryNullThenIllegalArgumentException() {
  this.clientRepository = null;
  assertThatThrownBy(() -> new OAuth2AuthorizationRequestRedirectWebFilter(this.clientRepository))
    .isInstanceOf(IllegalArgumentException.class);
}
origin: spring-projects/spring-security

@Before
public void setup() {
  this.filter = new OAuth2AuthorizationRequestRedirectWebFilter(this.clientRepository);
  this.filter.setAuthorizationRequestRepository(this.authzRequestRepository);
  FilteringWebHandler webHandler = new FilteringWebHandler(e -> e.getResponse().setComplete(), Arrays.asList(this.filter));
  this.client = WebTestClient.bindToWebHandler(webHandler).build();
  when(this.clientRepository.findByRegistrationId(this.registration.getRegistrationId())).thenReturn(
      Mono.just(this.registration));
  when(this.authzRequestRepository.saveAuthorizationRequest(any(), any())).thenReturn(
      Mono.empty());
}
origin: spring-projects/spring-security

protected void configure(ServerHttpSecurity http) {
  ReactiveClientRegistrationRepository clientRegistrationRepository = getClientRegistrationRepository();
  ServerOAuth2AuthorizedClientRepository authorizedClientRepository = getAuthorizedClientRepository();
  ServerAuthenticationConverter authenticationConverter = getAuthenticationConverter();
  ReactiveAuthenticationManager authenticationManager = getAuthenticationManager();
  OAuth2AuthorizationCodeGrantWebFilter codeGrantWebFilter = new OAuth2AuthorizationCodeGrantWebFilter(authenticationManager,
      authenticationConverter,
      authorizedClientRepository);
  OAuth2AuthorizationRequestRedirectWebFilter oauthRedirectFilter = new OAuth2AuthorizationRequestRedirectWebFilter(
      clientRegistrationRepository);
  http.addFilterAt(codeGrantWebFilter, SecurityWebFiltersOrder.OAUTH2_AUTHORIZATION_CODE);
  http.addFilterAt(oauthRedirectFilter, SecurityWebFiltersOrder.HTTP_BASIC);
}
origin: org.springframework.security/spring-security-config

protected void configure(ServerHttpSecurity http) {
  ReactiveClientRegistrationRepository clientRegistrationRepository = getClientRegistrationRepository();
  ServerOAuth2AuthorizedClientRepository authorizedClientRepository = getAuthorizedClientRepository();
  ServerAuthenticationConverter authenticationConverter = getAuthenticationConverter();
  ReactiveAuthenticationManager authenticationManager = getAuthenticationManager();
  OAuth2AuthorizationCodeGrantWebFilter codeGrantWebFilter = new OAuth2AuthorizationCodeGrantWebFilter(authenticationManager,
      authenticationConverter,
      authorizedClientRepository);
  OAuth2AuthorizationRequestRedirectWebFilter oauthRedirectFilter = new OAuth2AuthorizationRequestRedirectWebFilter(
      clientRegistrationRepository);
  http.addFilterAt(codeGrantWebFilter, SecurityWebFiltersOrder.OAUTH2_AUTHORIZATION_CODE);
  http.addFilterAt(oauthRedirectFilter, SecurityWebFiltersOrder.HTTP_BASIC);
}
origin: org.springframework.security/spring-security-config

protected void configure(ServerHttpSecurity http) {
  ReactiveClientRegistrationRepository clientRegistrationRepository = getClientRegistrationRepository();
  ServerOAuth2AuthorizedClientRepository authorizedClientRepository = getAuthorizedClientRepository();
  OAuth2AuthorizationRequestRedirectWebFilter oauthRedirectFilter = new OAuth2AuthorizationRequestRedirectWebFilter(clientRegistrationRepository);
  ReactiveAuthenticationManager manager = getAuthenticationManager();
  AuthenticationWebFilter authenticationFilter = new OAuth2LoginAuthenticationWebFilter(manager, authorizedClientRepository);
  authenticationFilter.setRequiresAuthenticationMatcher(createAttemptAuthenticationRequestMatcher());
  authenticationFilter.setServerAuthenticationConverter(getAuthenticationConverter(clientRegistrationRepository));
  RedirectServerAuthenticationSuccessHandler redirectHandler = new RedirectServerAuthenticationSuccessHandler();
  authenticationFilter.setAuthenticationSuccessHandler(redirectHandler);
  authenticationFilter.setAuthenticationFailureHandler(new ServerAuthenticationFailureHandler() {
    @Override
    public Mono<Void> onAuthenticationFailure(WebFilterExchange webFilterExchange,
        AuthenticationException exception) {
      return Mono.error(exception);
    }
  });
  authenticationFilter.setSecurityContextRepository(new WebSessionServerSecurityContextRepository());
  MediaTypeServerWebExchangeMatcher htmlMatcher = new MediaTypeServerWebExchangeMatcher(
      MediaType.TEXT_HTML);
  htmlMatcher.setIgnoredMediaTypes(Collections.singleton(MediaType.ALL));
  Map<String, String> urlToText = http.oauth2Login.getLinks();
  if (urlToText.size() == 1) {
    http.defaultEntryPoints.add(new DelegateEntry(htmlMatcher, new RedirectServerAuthenticationEntryPoint(urlToText.keySet().iterator().next())));
  } else {
    http.defaultEntryPoints.add(new DelegateEntry(htmlMatcher, new RedirectServerAuthenticationEntryPoint("/login")));
  }
  http.addFilterAt(oauthRedirectFilter, SecurityWebFiltersOrder.HTTP_BASIC);
  http.addFilterAt(authenticationFilter, SecurityWebFiltersOrder.AUTHENTICATION);
}
origin: apache/servicemix-bundles

protected void configure(ServerHttpSecurity http) {
  ReactiveClientRegistrationRepository clientRegistrationRepository = getClientRegistrationRepository();
  ServerOAuth2AuthorizedClientRepository authorizedClientRepository = getAuthorizedClientRepository();
  ServerAuthenticationConverter authenticationConverter = getAuthenticationConverter();
  ReactiveAuthenticationManager authenticationManager = getAuthenticationManager();
  OAuth2AuthorizationCodeGrantWebFilter codeGrantWebFilter = new OAuth2AuthorizationCodeGrantWebFilter(authenticationManager,
      authenticationConverter,
      authorizedClientRepository);
  OAuth2AuthorizationRequestRedirectWebFilter oauthRedirectFilter = new OAuth2AuthorizationRequestRedirectWebFilter(
      clientRegistrationRepository);
  http.addFilterAt(codeGrantWebFilter, SecurityWebFiltersOrder.OAUTH2_AUTHORIZATION_CODE);
  http.addFilterAt(oauthRedirectFilter, SecurityWebFiltersOrder.HTTP_BASIC);
}
origin: apache/servicemix-bundles

protected void configure(ServerHttpSecurity http) {
  ReactiveClientRegistrationRepository clientRegistrationRepository = getClientRegistrationRepository();
  ServerOAuth2AuthorizedClientRepository authorizedClientRepository = getAuthorizedClientRepository();
  OAuth2AuthorizationRequestRedirectWebFilter oauthRedirectFilter = new OAuth2AuthorizationRequestRedirectWebFilter(clientRegistrationRepository);
  ReactiveAuthenticationManager manager = getAuthenticationManager();
  AuthenticationWebFilter authenticationFilter = new OAuth2LoginAuthenticationWebFilter(manager, authorizedClientRepository);
  authenticationFilter.setRequiresAuthenticationMatcher(createAttemptAuthenticationRequestMatcher());
  authenticationFilter.setServerAuthenticationConverter(getAuthenticationConverter(clientRegistrationRepository));
  RedirectServerAuthenticationSuccessHandler redirectHandler = new RedirectServerAuthenticationSuccessHandler();
  authenticationFilter.setAuthenticationSuccessHandler(redirectHandler);
  authenticationFilter.setAuthenticationFailureHandler(new ServerAuthenticationFailureHandler() {
    @Override
    public Mono<Void> onAuthenticationFailure(WebFilterExchange webFilterExchange,
        AuthenticationException exception) {
      return Mono.error(exception);
    }
  });
  authenticationFilter.setSecurityContextRepository(new WebSessionServerSecurityContextRepository());
  MediaTypeServerWebExchangeMatcher htmlMatcher = new MediaTypeServerWebExchangeMatcher(
      MediaType.TEXT_HTML);
  htmlMatcher.setIgnoredMediaTypes(Collections.singleton(MediaType.ALL));
  Map<String, String> urlToText = http.oauth2Login.getLinks();
  if (urlToText.size() == 1) {
    http.defaultEntryPoints.add(new DelegateEntry(htmlMatcher, new RedirectServerAuthenticationEntryPoint(urlToText.keySet().iterator().next())));
  } else {
    http.defaultEntryPoints.add(new DelegateEntry(htmlMatcher, new RedirectServerAuthenticationEntryPoint("/login")));
  }
  http.addFilterAt(oauthRedirectFilter, SecurityWebFiltersOrder.HTTP_BASIC);
  http.addFilterAt(authenticationFilter, SecurityWebFiltersOrder.AUTHENTICATION);
}
org.springframework.security.oauth2.client.web.serverOAuth2AuthorizationRequestRedirectWebFilter<init>

Javadoc

Constructs an OAuth2AuthorizationRequestRedirectFilter using the provided parameters.

Popular methods of OAuth2AuthorizationRequestRedirectWebFilter

  • sendRedirectForAuthorization
  • setAuthorizationRequestRepository
    Sets the repository used for storing OAuth2AuthorizationRequest's.
  • setRequestCache
    The request cache to use to save the request before sending a redirect.

Popular in Java

  • Making http requests using okhttp
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • getContentResolver (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • JList (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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