|
@@ -40,7 +40,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
|
|
|
import org.springframework.security.config.test.SpringTestContext;
|
|
|
import org.springframework.security.config.test.SpringTestContextExtension;
|
|
|
import org.springframework.security.config.users.AuthenticationTestConfiguration;
|
|
|
-import org.springframework.security.core.GrantedAuthorities;
|
|
|
+import org.springframework.security.core.authority.FactorGrantedAuthority;
|
|
|
import org.springframework.security.core.context.SecurityContextChangedListener;
|
|
|
import org.springframework.security.core.context.SecurityContextHolderStrategy;
|
|
|
import org.springframework.security.core.userdetails.PasswordEncodedUser;
|
|
@@ -417,20 +417,20 @@ public class FormLoginConfigurerTests {
|
|
|
.andExpect(status().is3xxRedirection())
|
|
|
.andExpect(redirectedUrl("/"));
|
|
|
user = PasswordEncodedUser.withUserDetails(user)
|
|
|
- .authorities("profile:read", GrantedAuthorities.FACTOR_OTT_AUTHORITY)
|
|
|
+ .authorities("profile:read", FactorGrantedAuthority.OTT_AUTHORITY)
|
|
|
.build();
|
|
|
this.mockMvc.perform(get("/profile").with(user(user)))
|
|
|
.andExpect(status().is3xxRedirection())
|
|
|
.andExpect(redirectedUrl("http://localhost/login?factor.type=password&factor.reason=missing"));
|
|
|
user = PasswordEncodedUser.withUserDetails(user)
|
|
|
- .authorities("profile:read", GrantedAuthorities.FACTOR_PASSWORD_AUTHORITY)
|
|
|
+ .authorities("profile:read", FactorGrantedAuthority.PASSWORD_AUTHORITY)
|
|
|
.build();
|
|
|
this.mockMvc.perform(get("/profile").with(user(user)))
|
|
|
.andExpect(status().is3xxRedirection())
|
|
|
.andExpect(redirectedUrl("http://localhost/login?factor.type=ott&factor.reason=missing"));
|
|
|
user = PasswordEncodedUser.withUserDetails(user)
|
|
|
- .authorities("profile:read", GrantedAuthorities.FACTOR_PASSWORD_AUTHORITY,
|
|
|
- GrantedAuthorities.FACTOR_OTT_AUTHORITY)
|
|
|
+ .authorities("profile:read", FactorGrantedAuthority.PASSWORD_AUTHORITY,
|
|
|
+ FactorGrantedAuthority.OTT_AUTHORITY)
|
|
|
.build();
|
|
|
this.mockMvc.perform(get("/profile").with(user(user))).andExpect(status().isNotFound());
|
|
|
}
|
|
@@ -453,8 +453,8 @@ public class FormLoginConfigurerTests {
|
|
|
.andExpect(status().is3xxRedirection())
|
|
|
.andExpect(redirectedUrl("/"));
|
|
|
UserDetails authorized = PasswordEncodedUser.withUsername("rod")
|
|
|
- .authorities("profile:read", GrantedAuthorities.FACTOR_X509_AUTHORITY,
|
|
|
- GrantedAuthorities.FACTOR_PASSWORD_AUTHORITY)
|
|
|
+ .authorities("profile:read", FactorGrantedAuthority.X509_AUTHORITY,
|
|
|
+ FactorGrantedAuthority.PASSWORD_AUTHORITY)
|
|
|
.build();
|
|
|
this.mockMvc.perform(get("/profile").with(user(authorized))).andExpect(status().isOk());
|
|
|
}
|
|
@@ -821,8 +821,8 @@ public class FormLoginConfigurerTests {
|
|
|
|
|
|
@Bean
|
|
|
AuthorizationManagerFactory<?> authz() {
|
|
|
- return new AuthorizationManagerFactory<>(GrantedAuthorities.FACTOR_PASSWORD_AUTHORITY,
|
|
|
- GrantedAuthorities.FACTOR_OTT_AUTHORITY);
|
|
|
+ return new AuthorizationManagerFactory<>(FactorGrantedAuthority.PASSWORD_AUTHORITY,
|
|
|
+ FactorGrantedAuthority.OTT_AUTHORITY);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -848,8 +848,8 @@ public class FormLoginConfigurerTests {
|
|
|
|
|
|
@Bean
|
|
|
AuthorizationManagerFactory<?> authz() {
|
|
|
- return new AuthorizationManagerFactory<>(GrantedAuthorities.FACTOR_X509_AUTHORITY,
|
|
|
- GrantedAuthorities.FACTOR_PASSWORD_AUTHORITY);
|
|
|
+ return new AuthorizationManagerFactory<>(FactorGrantedAuthority.X509_AUTHORITY,
|
|
|
+ FactorGrantedAuthority.PASSWORD_AUTHORITY);
|
|
|
}
|
|
|
|
|
|
}
|