BAEL-4628 - Spring Security SAMl with Okta
This commit is contained in:
		
							parent
							
								
									bc4ea42b7d
								
							
						
					
					
						commit
						bb5cf873c8
					
				| @ -130,12 +130,6 @@ public class SamlSecurityConfig { | |||||||
|         return samlEntryPoint; |         return samlEntryPoint; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Bean |  | ||||||
|     public SAMLDiscovery samlIDPDiscovery() { |  | ||||||
|         SAMLDiscovery idpDiscovery = new SAMLDiscovery(); |  | ||||||
|         return idpDiscovery; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     @Bean |     @Bean | ||||||
|     public ExtendedMetadata extendedMetadata() { |     public ExtendedMetadata extendedMetadata() { | ||||||
|         ExtendedMetadata extendedMetadata = new ExtendedMetadata(); |         ExtendedMetadata extendedMetadata = new ExtendedMetadata(); | ||||||
|  | |||||||
| @ -53,8 +53,11 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | |||||||
|     @Autowired |     @Autowired | ||||||
|     private SAMLLogoutProcessingFilter samlLogoutProcessingFilter; |     private SAMLLogoutProcessingFilter samlLogoutProcessingFilter; | ||||||
| 
 | 
 | ||||||
|     @Autowired |     @Bean | ||||||
|     private SAMLDiscovery samlDiscovery; |     public SAMLDiscovery samlDiscovery() { | ||||||
|  |         SAMLDiscovery idpDiscovery = new SAMLDiscovery(); | ||||||
|  |         return idpDiscovery; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     @Autowired |     @Autowired | ||||||
|     private SAMLAuthenticationProvider samlAuthenticationProvider; |     private SAMLAuthenticationProvider samlAuthenticationProvider; | ||||||
| @ -89,7 +92,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | |||||||
|         chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSO/**"), |         chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSO/**"), | ||||||
|             samlWebSSOProcessingFilter())); |             samlWebSSOProcessingFilter())); | ||||||
|         chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/discovery/**"), |         chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/discovery/**"), | ||||||
|             samlDiscovery)); |             samlDiscovery())); | ||||||
|         chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/login/**"), |         chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/login/**"), | ||||||
|             samlEntryPoint)); |             samlEntryPoint)); | ||||||
|         chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/logout/**"), |         chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/logout/**"), | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| saml.keystore.location=classpath:/saml/samlKeystore.jks | saml.keystore.location=classpath:/saml/samlKeystore.jks | ||||||
| saml.keystore.password=oktaiscool | saml.keystore.password=<key_pass> | ||||||
| saml.keystore.alias=oktasaml | saml.keystore.alias=<key_alias> | ||||||
| 
 | 
 | ||||||
| saml.idp=http://www.okta.com/exk26fxqrz8LLk9dV4x7 | saml.idp=<idp_issuer_url> | ||||||
| saml.sp=http://localhost:8080/saml/metadata | saml.sp=http://localhost:8080/saml/metadata | ||||||
| @ -6,10 +6,8 @@ | |||||||
| <body> | <body> | ||||||
|     <h3><Strong>Welcome!</strong><br/>You are successfully logged in!</h3> |     <h3><Strong>Welcome!</strong><br/>You are successfully logged in!</h3> | ||||||
|     <p>You are logged as <span class="badge badge-dark" th:text="${username}">null</span>.</p> |     <p>You are logged as <span class="badge badge-dark" th:text="${username}">null</span>.</p> | ||||||
|     <small class="d-block text-right mt-3" id="sso-btn"> |     <small> | ||||||
|         <a th:href="@{/logout}" class="btn btn-spring btn-sm"> |         <a th:href="@{/logout}">Logout</a> | ||||||
|             <i class="far fa-user-circle"></i> Logout |  | ||||||
|         </a> |  | ||||||
|     </small> |     </small> | ||||||
| </body> | </body> | ||||||
| </html> | </html> | ||||||
| @ -5,8 +5,6 @@ | |||||||
| </head> | </head> | ||||||
| <body> | <body> | ||||||
|     <h3><Strong>Welcome to Baeldung Spring Security SAML</strong></h3> |     <h3><Strong>Welcome to Baeldung Spring Security SAML</strong></h3> | ||||||
|     <a th:href="@{/auth}" class="btn btn-spring btn-sm"> |     <a th:href="@{/auth}">Login</a> | ||||||
|         <i class="far fa-user-circle"></i> Login |  | ||||||
|     </a> |  | ||||||
| </body> | </body> | ||||||
| </html> | </html> | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user