21
21
package eu .openanalytics .containerproxy .auth .impl .saml ;
22
22
23
23
import eu .openanalytics .containerproxy .auth .UserLogoutHandler ;
24
- import java .util .ArrayList ;
25
- import java .util .Arrays ;
26
- import java .util .Collection ;
27
- import java .util .HashMap ;
28
- import java .util .List ;
29
- import java .util .Map ;
30
- import java .util .Timer ;
31
-
32
- import javax .inject .Inject ;
33
-
34
24
import eu .openanalytics .containerproxy .auth .impl .SAMLAuthenticationBackend ;
35
25
import org .apache .commons .httpclient .HttpClient ;
36
26
import org .apache .logging .log4j .LogManager ;
37
27
import org .apache .logging .log4j .Logger ;
38
28
import org .apache .velocity .app .VelocityEngine ;
39
- import org .opensaml .saml2 .core .Attribute ;
40
29
import org .opensaml .saml2 .metadata .provider .HTTPMetadataProvider ;
41
30
import org .opensaml .saml2 .metadata .provider .MetadataProvider ;
42
31
import org .opensaml .saml2 .metadata .provider .MetadataProviderException ;
43
32
import org .opensaml .util .resource .ResourceException ;
44
- import org .opensaml .xml .XMLObject ;
45
33
import org .opensaml .xml .parse .StaticBasicParserPool ;
46
34
import org .opensaml .xml .parse .XMLParserException ;
47
- import org .opensaml .xml .schema .XSAny ;
48
- import org .opensaml .xml .schema .XSString ;
49
35
import org .springframework .beans .factory .annotation .Qualifier ;
50
36
import org .springframework .boot .autoconfigure .condition .ConditionalOnProperty ;
51
37
import org .springframework .context .annotation .Bean ;
60
46
import org .springframework .security .core .userdetails .User ;
61
47
import org .springframework .security .core .userdetails .UsernameNotFoundException ;
62
48
import org .springframework .security .saml .*;
63
- import org .springframework .security .saml .context .SAMLContextProvider ;
64
49
import org .springframework .security .saml .context .SAMLContextProviderImpl ;
65
50
import org .springframework .security .saml .key .EmptyKeyManager ;
66
51
import org .springframework .security .saml .key .JKSKeyManager ;
74
59
import org .springframework .security .saml .processor .SAMLProcessorImpl ;
75
60
import org .springframework .security .saml .userdetails .SAMLUserDetailsService ;
76
61
import org .springframework .security .saml .util .VelocityFactory ;
77
- import org .springframework .security .saml .websso .SingleLogoutProfile ;
78
- import org .springframework .security .saml .websso .SingleLogoutProfileImpl ;
79
- import org .springframework .security .saml .websso .WebSSOProfile ;
80
- import org .springframework .security .saml .websso .WebSSOProfileConsumer ;
81
- import org .springframework .security .saml .websso .WebSSOProfileConsumerHoKImpl ;
82
- import org .springframework .security .saml .websso .WebSSOProfileConsumerImpl ;
83
- import org .springframework .security .saml .websso .WebSSOProfileImpl ;
84
- import org .springframework .security .saml .websso .WebSSOProfileOptions ;
62
+ import org .springframework .security .saml .websso .*;
85
63
import org .springframework .security .web .DefaultSecurityFilterChain ;
86
64
import org .springframework .security .web .FilterChainProxy ;
87
65
import org .springframework .security .web .SecurityFilterChain ;
92
70
import org .springframework .security .web .authentication .logout .SimpleUrlLogoutSuccessHandler ;
93
71
import org .springframework .security .web .util .matcher .AntPathRequestMatcher ;
94
72
73
+ import javax .inject .Inject ;
74
+ import java .util .*;
75
+
95
76
@ Configuration
96
77
@ ConditionalOnProperty (name ="proxy.authentication" , havingValue ="saml" )
97
78
public class SAMLConfiguration {
@@ -326,6 +307,11 @@ public SAMLProcessingFilter samlWebSSOProcessingFilter() throws Exception {
326
307
return samlWebSSOProcessingFilter ;
327
308
}
328
309
310
+ @ Bean
311
+ public AlreadyLoggedInFilter alreadyLoggedInFilter () {
312
+ return new AlreadyLoggedInFilter ();
313
+ }
314
+
329
315
@ Bean
330
316
public WebSSOProfileConsumer webSSOprofileConsumer () {
331
317
return new WebSSOProfileConsumerImpl ();
@@ -342,7 +328,7 @@ public SAMLFilterSet samlFilter() throws Exception {
342
328
chains .add (new DefaultSecurityFilterChain (new AntPathRequestMatcher ("/saml/login/**" ), samlEntryPoint ()));
343
329
chains .add (new DefaultSecurityFilterChain (new AntPathRequestMatcher ("/saml/logout/**" ), samlLogoutFilter ()));
344
330
chains .add (new DefaultSecurityFilterChain (new AntPathRequestMatcher ("/saml/SingleLogout/**" ), samlLogoutProcessingFilter ()));
345
- chains .add (new DefaultSecurityFilterChain (new AntPathRequestMatcher ("/saml/SSO/**" ), samlWebSSOProcessingFilter ()));
331
+ chains .add (new DefaultSecurityFilterChain (new AntPathRequestMatcher ("/saml/SSO/**" ), alreadyLoggedInFilter (), samlWebSSOProcessingFilter ()));
346
332
return new SAMLFilterSet (chains );
347
333
}
348
334
0 commit comments