Tabnine Logo
ServerHttpSecurity$OAuth2LoginSpec
Code IndexAdd Tabnine to your IDE (free)

How to use
ServerHttpSecurity$OAuth2LoginSpec
in
org.springframework.security.config.web.server

Best Java code snippets using org.springframework.security.config.web.server.ServerHttpSecurity$OAuth2LoginSpec (Showing top 20 results out of 315)

origin: spring-projects/spring-security

this.oauth2Login.configure(this);
origin: spring-projects/spring-security

protected void configure(ServerHttpSecurity http) {
  ReactiveClientRegistrationRepository clientRegistrationRepository = getClientRegistrationRepository();
  ServerOAuth2AuthorizedClientRepository authorizedClientRepository = getAuthorizedClientRepository();
  OAuth2AuthorizationRequestRedirectWebFilter oauthRedirectFilter = getRedirectWebFilter();
  ReactiveAuthenticationManager manager = getAuthenticationManager();
  AuthenticationWebFilter authenticationFilter = new OAuth2LoginAuthenticationWebFilter(manager, authorizedClientRepository);
  authenticationFilter.setRequiresAuthenticationMatcher(getAuthenticationMatcher());
  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

this.oauth2Login.configure(this);
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);
}
origin: apache/servicemix-bundles

private ServerOAuth2AuthorizedClientRepository getAuthorizedClientRepository() {
  ServerOAuth2AuthorizedClientRepository result = this.authorizedClientRepository;
  if (result == null) {
    result = getBeanOrNull(ServerOAuth2AuthorizedClientRepository.class);
  }
  if (result == null) {
    ReactiveOAuth2AuthorizedClientService authorizedClientService = getAuthorizedClientService();
    if (authorizedClientService != null) {
      result = new AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository(
          authorizedClientService);
    }
  }
  return result;
}
origin: apache/servicemix-bundles

/**
 * Gets the {@link ReactiveAuthenticationManager} to use. First tries an explicitly configured manager, and
 * defaults to {@link OAuth2AuthorizationCodeReactiveAuthenticationManager}
 *
 * @return the {@link ReactiveAuthenticationManager} to use
 */
private ReactiveAuthenticationManager getAuthenticationManager() {
  if (this.authenticationManager == null) {
    this.authenticationManager = createDefault();
  }
  return this.authenticationManager;
}
origin: apache/servicemix-bundles

private ReactiveOAuth2AuthorizedClientService getAuthorizedClientService() {
  ReactiveOAuth2AuthorizedClientService service = getBeanOrNull(ReactiveOAuth2AuthorizedClientService.class);
  if (service == null) {
    service = new InMemoryReactiveOAuth2AuthorizedClientService(getClientRegistrationRepository());
  }
  return service;
}
origin: apache/servicemix-bundles

public OAuth2LoginSpec oauth2Login() {
  if (this.oauth2Login == null) {
    this.oauth2Login = new OAuth2LoginSpec();
  }
  return this.oauth2Login;
}
origin: org.springframework.security/spring-security-config

this.oauth2Login.configure(this);
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: org.springframework.security/spring-security-config

private ServerOAuth2AuthorizedClientRepository getAuthorizedClientRepository() {
  ServerOAuth2AuthorizedClientRepository result = this.authorizedClientRepository;
  if (result == null) {
    result = getBeanOrNull(ServerOAuth2AuthorizedClientRepository.class);
  }
  if (result == null) {
    ReactiveOAuth2AuthorizedClientService authorizedClientService = getAuthorizedClientService();
    if (authorizedClientService != null) {
      result = new AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository(
          authorizedClientService);
    }
  }
  return result;
}
origin: org.springframework.security/spring-security-config

private ReactiveOAuth2AuthorizedClientService getAuthorizedClientService() {
  ReactiveOAuth2AuthorizedClientService service = getBeanOrNull(ReactiveOAuth2AuthorizedClientService.class);
  if (service == null) {
    service = new InMemoryReactiveOAuth2AuthorizedClientService(getClientRegistrationRepository());
  }
  return service;
}
origin: org.springframework.security/spring-security-config

/**
 * Gets the {@link ReactiveAuthenticationManager} to use. First tries an explicitly configured manager, and
 * defaults to {@link OAuth2AuthorizationCodeReactiveAuthenticationManager}
 *
 * @return the {@link ReactiveAuthenticationManager} to use
 */
private ReactiveAuthenticationManager getAuthenticationManager() {
  if (this.authenticationManager == null) {
    this.authenticationManager = createDefault();
  }
  return this.authenticationManager;
}
origin: org.springframework.security/spring-security-config

public OAuth2LoginSpec oauth2Login() {
  if (this.oauth2Login == null) {
    this.oauth2Login = new OAuth2LoginSpec();
  }
  return this.oauth2Login;
}
origin: spring-projects/spring-security

private ServerOAuth2AuthorizedClientRepository getAuthorizedClientRepository() {
  ServerOAuth2AuthorizedClientRepository result = this.authorizedClientRepository;
  if (result == null) {
    result = getBeanOrNull(ServerOAuth2AuthorizedClientRepository.class);
  }
  if (result == null) {
    ReactiveOAuth2AuthorizedClientService authorizedClientService = getAuthorizedClientService();
    if (authorizedClientService != null) {
      result = new AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository(
          authorizedClientService);
    }
  }
  return result;
}
origin: spring-projects/spring-security

/**
 * Gets the {@link ReactiveAuthenticationManager} to use. First tries an explicitly configured manager, and
 * defaults to {@link OAuth2AuthorizationCodeReactiveAuthenticationManager}
 *
 * @return the {@link ReactiveAuthenticationManager} to use
 */
private ReactiveAuthenticationManager getAuthenticationManager() {
  if (this.authenticationManager == null) {
    this.authenticationManager = createDefault();
  }
  return this.authenticationManager;
}
origin: spring-projects/spring-security

private ServerWebExchangeMatcher getAuthenticationMatcher() {
  if (this.authenticationMatcher == null) {
    this.authenticationMatcher = createAttemptAuthenticationRequestMatcher();
  }
  return this.authenticationMatcher;
}
origin: spring-projects/spring-security

private ReactiveOAuth2AuthorizedClientService getAuthorizedClientService() {
  ReactiveOAuth2AuthorizedClientService service = getBeanOrNull(ReactiveOAuth2AuthorizedClientService.class);
  if (service == null) {
    service = new InMemoryReactiveOAuth2AuthorizedClientService(getClientRegistrationRepository());
  }
  return service;
}
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

public OAuth2LoginSpec oauth2Login() {
  if (this.oauth2Login == null) {
    this.oauth2Login = new OAuth2LoginSpec();
  }
  return this.oauth2Login;
}
org.springframework.security.config.web.serverServerHttpSecurity$OAuth2LoginSpec

Most used methods

  • <init>
  • configure
  • createAttemptAuthenticationRequestMatcher
  • createDefault
  • getAuthenticationConverter
  • getAuthenticationManager
    Gets the ReactiveAuthenticationManager to use. First tries an explicitly configured manager, and def
  • getAuthorizedClientRepository
  • getAuthorizedClientService
  • getClientRegistrationRepository
  • getLinks
  • getOauth2UserService
  • getOidcUserService
  • getOauth2UserService,
  • getOidcUserService,
  • and,
  • authenticationConverter,
  • authenticationManager,
  • authenticationMatcher,
  • authorizationRequestResolver,
  • getAuthenticationMatcher,
  • getRedirectWebFilter

Popular in Java

  • Making http post requests using okhttp
  • setContentView (Activity)
  • scheduleAtFixedRate (Timer)
  • onRequestPermissionsResult (Fragment)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Top plugins for WebStorm
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