Last active
May 20, 2016 21:55
-
-
Save fhanik/cd4de5baaf70cbbc21386ced71e4ac97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class AuthcodeApplication extends OpenIdConnectConfigurerAdapter { | |
| @RequestMapping("/oidc") | |
| public String oidc(IdToken token) { | |
| System.out.println("First name:" + token.getFirstName()); | |
| return "oidc"; | |
| } | |
| @Override | |
| protected void configure(OpenIdConnectSecurity http) throws Exception { | |
| http | |
| .antMatcher("/oidc").authorizeRequests().withIdToken() | |
| .antMatchers("/oidc").access("@scopeChecker.hasAnyScope(authentication, 'openid')") | |
| .and() | |
| .antMatcher("/**").authorizeRequests() | |
| .antMatchers("/", "/index", "/error").permitAll() | |
| .anyRequest().authenticated(); | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The goals of this Gist would be to demonstrate how one may want to use Spring Cloud to enable both access_token and id_token to be available to a Spring Boot application.
Line 2 and Line 10- ability to override
configureto protect endpointsLine 4 - make id_token accessible through automatic injection
Line 12 - add support for
withIdTokento enable retrieval of id_token (hybrid or during code to token exchange)Spring Boot Application as it works today. Proposed functionality of
OpenIdConnectConfigurerAdapter,OpenIdConnectSecuritynot available.