Skip to content
Snippets Groups Projects
Commit 3675f235 authored by Nicholas Blair's avatar Nicholas Blair
Browse files

feat: namespace all Spring Profiles with 'edu.wisc.uwss' prefix

Thus begins the deprecation path for the profiles 'local-users' and 'preauth'.
parent e053c095
No related branches found
No related tags found
1 merge request!20feat: namespace all Spring Profiles with 'edu.wisc.uwss' prefix
Showing
with 37 additions and 13 deletions
......@@ -3,10 +3,14 @@
*/
package edu.wisc.uwss.configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.env.Environment;
/**
* Root {@link Configuration} class that consuming applications should reference in their ApplicationInitizalizers.
......@@ -23,4 +27,24 @@ import org.springframework.context.annotation.Import;
@Import(UWSpringSecurityWebConfigurerAdapter.class)
public class UWSpringSecurityConfiguration {
private static final Logger logger = LoggerFactory.getLogger(UWSpringSecurityConfiguration.class);
/**
* 'local-users' and 'preauth' Profiles were replaced by 'edu.wisc.uwss.local-users' and
* 'edu.wisc.uwss.preauth', respectively.
*
* Part of the deprecation path for those legacy profiles is to warn deployers to use their
* replacements instead.
*
* @param environment
*/
@Autowired
void warnOnDeprecatedProfiles(Environment environment) {
if(environment.acceptsProfiles("local-users")) {
logger.warn("'local-users' profile is deprecated, please use 'edu.wisc.uwss.local-users' instead");
}
if(environment.acceptsProfiles("preauth")) {
logger.warn("'preauth' profile is deprecated, please use 'edu.wisc.uwss.preauth' instead");
}
}
}
......@@ -28,7 +28,7 @@ import edu.wisc.uwss.local.LocalUserDetailsManagerImpl;
* @author Nicholas Blair
*/
@Configuration
@Profile("local-users")
@Profile({"local-users", "edu.wisc.uwss.local-users"})
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class LocalAuthenticationSecurityConfiguration extends GlobalMethodSecurityConfiguration implements ResourceLoaderAware {
......
......@@ -25,7 +25,7 @@ import edu.wisc.uwss.configuration.combined.CombinedAuthentication;
*/
@Configuration
@EnableWebSecurity
@Profile("local-users")
@Profile({"local-users", "edu.wisc.uwss.local-users"})
@Order(CombinedAuthentication.LOCAL_USERS_WEB_SECURITY_CONFIGURATION_ORDER)
public class LocalUsersWebSecurityConfiguration {
......
......@@ -31,7 +31,7 @@ import edu.wisc.uwss.configuration.development.SimulatePreAuthenticationHttpSecu
* @author Collin Cudd
*/
@Configuration
@Profile("preauth-dev")
@Profile({ "preauth-dev", "edu.wisc.uwss.preauth-dev" })
public class PreAuthenticationDevelopmentConfiguration {
private static final Logger logger = LoggerFactory.getLogger(PreAuthenticationDevelopmentConfiguration.class);
......
......@@ -29,7 +29,7 @@ import edu.wisc.uwss.preauth.UWUserDetailsAuthenticationUserDetailsService;
* @author Nicholas Blair
*/
@Configuration
@Profile("preauth")
@Profile({ "preauth", "edu.wisc.uwss.preauth" })
@EnableGlobalMethodSecurity(prePostEnabled=true)
public class PreAuthenticationSecurityConfiguration extends GlobalMethodSecurityConfiguration {
......
......@@ -35,7 +35,7 @@ import edu.wisc.uwss.preauth.UWUserDetailsAuthenticationFilter;
* @author Nicholas Blair
*/
@Configuration
@Profile("preauth")
@Profile({ "preauth", "edu.wisc.uwss.preauth" })
@Order(CombinedAuthentication.PREAUTH_WEB_SECURITY_CONFIGURATION_ORDER)
public class PreAuthenticationWebSecurityConfiguration {
......
......@@ -30,7 +30,7 @@ import edu.wisc.uwss.UWUserDetails;
*
* @author Nicholas Blair
*/
@Profile("local-users")
@Profile({ "local-users", "edu.wisc.uwss.local-users" })
public class LocalUsersUdsPersonServiceImpl implements UdsPersonService {
private final Logger logger = LoggerFactory.getLogger(getClass());
......
......@@ -17,7 +17,7 @@ import edu.wisc.uwss.UWUserDetails;
*
* @author Nicholas Blair
*/
@Profile("preauth")
@Profile({ "preauth", "edu.wisc.uwss.preauth" })
public class UWUserDetailsAuthenticationUserDetailsService implements
AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> {
......
......@@ -11,7 +11,7 @@
<packaging>war</packaging>
<properties>
<activeProfiles>local-users</activeProfiles>
<activeProfiles>edu.wisc.uwss.local-users</activeProfiles>
</properties>
<dependencies>
<dependency>
......@@ -100,25 +100,25 @@
<profile>
<id>preauth</id>
<properties>
<activeProfiles>preauth</activeProfiles>
<activeProfiles>edu.wisc.uwss.preauth</activeProfiles>
</properties>
</profile>
<profile>
<id>combined</id>
<properties>
<activeProfiles>local-users,preauth,edu.wisc.uwss.simulated-shibboleth</activeProfiles>
<activeProfiles>edu.wisc.uwss.local-users,edu.wisc.uwss.preauth,edu.wisc.uwss.simulated-shibboleth</activeProfiles>
</properties>
</profile>
<profile>
<id>combined-simulate-netid</id>
<properties>
<activeProfiles>local-users,preauth,preauth-simulate-netid</activeProfiles>
<activeProfiles>edu.wisc.uwss.local-users,edu.wisc.uwss.preauth,edu.wisc.uwss.preauth-simulate-netid</activeProfiles>
</properties>
</profile>
<profile>
<id>combined-simulate-federation</id>
<properties>
<activeProfiles>local-users,preauth,preauth-simulate-netid,edu.wisc.uwss.preauth.federation</activeProfiles>
<activeProfiles>edu.wisc.uwss.local-users,edu.wisc.uwss.preauth,edu.wisc.uwss.preauth-simulate-netid,edu.wisc.uwss.preauth.federation</activeProfiles>
</properties>
</profile>
</profiles>
......
......@@ -43,7 +43,7 @@ import edu.wisc.uwss.configuration.development.SimulatePreAuthenticationHttpSecu
* @author Nicholas Blair
*/
@Configuration
@Profile("preauth-simulate-netid")
@Profile("edu.wisc.uwss.preauth-simulate-netid")
public class DemonstrationOnlyPreAuthenticationConfiguration {
@Inject
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment