From 3388fbdd48ae02776903b2134cab6b8c4bf27d12 Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Wed, 28 Aug 2019 22:49:36 -0700 Subject: [PATCH] DRYD-736: Adding Spring Security config for handling post-auth events. Will use to track user logins. --- .../webapp/WEB-INF/applicationContext-security.xml | 2 ++ .../CSpaceAuthenticationSuccessEvent.java | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 services/authentication/service/src/main/java/org/collectionspace/authentication/CSpaceAuthenticationSuccessEvent.java diff --git a/services/JaxRsServiceProvider/src/main/webapp/WEB-INF/applicationContext-security.xml b/services/JaxRsServiceProvider/src/main/webapp/WEB-INF/applicationContext-security.xml index a12b8e497..6ebc272ca 100644 --- a/services/JaxRsServiceProvider/src/main/webapp/WEB-INF/applicationContext-security.xml +++ b/services/JaxRsServiceProvider/src/main/webapp/WEB-INF/applicationContext-security.xml @@ -21,6 +21,8 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> + + diff --git a/services/authentication/service/src/main/java/org/collectionspace/authentication/CSpaceAuthenticationSuccessEvent.java b/services/authentication/service/src/main/java/org/collectionspace/authentication/CSpaceAuthenticationSuccessEvent.java new file mode 100644 index 000000000..a325cd053 --- /dev/null +++ b/services/authentication/service/src/main/java/org/collectionspace/authentication/CSpaceAuthenticationSuccessEvent.java @@ -0,0 +1,14 @@ +package org.collectionspace.authentication; + +import org.springframework.context.ApplicationListener; +import org.springframework.security.authentication.event.AuthenticationSuccessEvent; + +public class CSpaceAuthenticationSuccessEvent implements ApplicationListener { + + @Override + public void onApplicationEvent(AuthenticationSuccessEvent event) { + // TODO Auto-generated method stub + System.out.println(); //org.springframework.security.authentication.UsernamePasswordAuthenticationToken@8a633e91: Principal: org.collectionspace.authentication.CSpaceUser@b122ec20: Username: admin@core.collectionspace.org; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_1_TENANT_ADMINISTRATOR,ROLE_SPRING_ADMIN; Credentials: [PROTECTED]; Authenticated: true; Details: {grant_type=password, username=admin@core.collectionspace.org}; Granted Authorities: ROLE_1_TENANT_ADMINISTRATOR, ROLE_SPRING_ADMIN + } + +} -- 2.47.3