-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP configuration changes Docker rework
- Loading branch information
Showing
11 changed files
with
150 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| FROM unicon/shibui | ||
|
|
||
| COPY *.jar /libs/ |
This file contains 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
This file contains 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
34 changes: 33 additions & 1 deletion
34
pac4j-module/src/main/java/net/unicon/shibui/pac4j/WebSecurity.java
This file contains 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,46 @@ | ||
| package net.unicon.shibui.pac4j; | ||
|
|
||
| import org.pac4j.core.config.Config; | ||
| import org.pac4j.springframework.security.web.CallbackFilter; | ||
| import org.pac4j.springframework.security.web.SecurityFilter; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.core.annotation.Order; | ||
| import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
| import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
| import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
| import org.springframework.security.config.http.SessionCreationPolicy; | ||
| import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; | ||
| import org.springframework.security.web.csrf.CookieCsrfTokenRepository; | ||
|
|
||
| @Configuration | ||
| @EnableWebSecurity | ||
| public class WebSecurity { | ||
| @Configuration | ||
| @Order(1) | ||
| public static class Pac4jSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter { | ||
| private static final Logger logger = LoggerFactory.getLogger(Pac4jSecurityConfigurationAdapter.class); | ||
|
|
||
| private final Config config; | ||
|
|
||
| public Pac4jSecurityConfigurationAdapter(Config config) { | ||
| logger.info("configuring pac4j authentication"); | ||
| this.config = config; | ||
| } | ||
|
|
||
| @Override | ||
| protected void configure(HttpSecurity http) throws Exception { | ||
| final SecurityFilter securityFilter = new SecurityFilter(this.config, "Saml2Client"); | ||
|
|
||
| final CallbackFilter callbackFilter = new CallbackFilter(this.config); | ||
| http.antMatcher("/**").addFilterBefore(callbackFilter, BasicAuthenticationFilter.class); | ||
| http.authorizeRequests().anyRequest().fullyAuthenticated(); | ||
|
|
||
| http.addFilterBefore(securityFilter, BasicAuthenticationFilter.class); | ||
| http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.ALWAYS); | ||
|
|
||
| http.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()); | ||
| } | ||
| } | ||
| } |
This file contains 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer = net.unicon.shibui.pac4j.WebSecurity.Pac4jSecurityConfigurationAdapter | ||
| org.springframework.boot.autoconfigure.EnableAutoConfiguration=net.unicon.shibui.pac4j.Pac4jConfiguration,net.unicon.shibui.pac4j.WebSecurity,net.unicon.shibui.pac4j.WebSecurity.Pac4jSecurityConfigurationAdapter,net.unicon.shibui.pac4j.Pac4jConfigurationProperties |
This file contains 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| shibui: | ||
| pac4j: | ||
| keystorePath: "/conf/samlKeystore.jks" | ||
| keystorePassword: "changeit" | ||
| privateKeyPassword: "changeit" | ||
| serviceProviderEntityId: "https://unicon.net/shibui" | ||
| serviceProviderMetadataPath: "/conf/sp-metadata.xml" | ||
| forceServiceProviderMetadataGeneration: true | ||
| callbackUrl: "http://localhost:8080/callback |
This file contains 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
| <md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" entityID="https://accounts.google.com/o/saml2?idpid=C04alwt8m" validUntil="2021-06-30T14:58:44.000Z"> | ||
| <md:IDPSSODescriptor WantAuthnRequestsSigned="false" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"> | ||
| <md:KeyDescriptor use="signing"> | ||
| <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> | ||
| <ds:X509Data> | ||
| <ds:X509Certificate>MIIDdDCCAlygAwIBAgIGAVWm+BpSMA0GCSqGSIb3DQEBCwUAMHsxFDASBgNVBAoTC0dvb2dsZSBJ | ||
| bmMuMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MQ8w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z8Y1FhU6rWBdBRtaiASAIgkNwOmS603Mm08Yr | ||
| 0Yq7x6h3XlG8HO0bAOto6pr6q85pLqqv7v7/x7mfdjV3</ds:X509Certificate> | ||
| </ds:X509Data> | ||
| </ds:KeyInfo> | ||
| </md:KeyDescriptor> | ||
| <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</md:NameIDFormat> | ||
| <md:SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://accounts.google.com/o/saml2/idp?idpid=C04alwt8m"/> | ||
| <md:SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://accounts.google.com/o/saml2/idp?idpid=C04alwt8m"/> | ||
| </md:IDPSSODescriptor> | ||
| </md:EntityDescriptor> |
This file contains 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| version: "3.7" | ||
|
|
||
| services: | ||
| shibui: | ||
| image: unicon/shibui-pac4j | ||
| command: "--shibui.pac4j.callbackUrl=http://localhost:8080/callback" | ||
| ports: | ||
| - 8080:8080 | ||
| - 5005:5005 | ||
| volumes: | ||
| - ./conf:/conf | ||
| - ./conf/application.yml:/application.yml | ||
| networks: | ||
| - front | ||
| networks: | ||
| front: | ||
| driver: bridge |