Rename @TransientAuthentication to @Transient

It is quite likely we will need to prevent certain Exceptions from being
saved or from triggering a saved request. When we add support for this,
we can now leverage @Transient vs creating a new annotation.

Issue: gh-5481
This commit is contained in:
Rob Winch 2018-07-16 11:31:10 -05:00
parent ed3ed5e64c
commit d595098823
6 changed files with 12 additions and 12 deletions

View File

@ -29,7 +29,7 @@ import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.config.test.SpringTestRule; import org.springframework.security.config.test.SpringTestRule;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.TransientAuthentication; import org.springframework.security.core.Transient;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.MvcResult;
@ -104,7 +104,7 @@ public class SessionManagementConfigurerTransientAuthenticationTests {
} }
} }
@TransientAuthentication @Transient
static class SomeTransientAuthentication extends AbstractAuthenticationToken { static class SomeTransientAuthentication extends AbstractAuthenticationToken {
SomeTransientAuthentication() { SomeTransientAuthentication() {
super(null); super(null);

View File

@ -24,7 +24,7 @@ import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.config.test.SpringTestRule; import org.springframework.security.config.test.SpringTestRule;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.TransientAuthentication; import org.springframework.security.core.Transient;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.MvcResult;
@ -75,7 +75,7 @@ public class SessionManagementConfigTransientAuthenticationTests {
} }
} }
@TransientAuthentication @Transient
static class SomeTransientAuthentication extends AbstractAuthenticationToken { static class SomeTransientAuthentication extends AbstractAuthenticationToken {
SomeTransientAuthentication() { SomeTransientAuthentication() {
super(null); super(null);

View File

@ -34,5 +34,5 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Inherited @Inherited
@Documented @Documented
public @interface TransientAuthentication { public @interface Transient {
} }

View File

@ -20,7 +20,7 @@ import java.util.Map;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.SpringSecurityCoreVersion; import org.springframework.security.core.SpringSecurityCoreVersion;
import org.springframework.security.core.TransientAuthentication; import org.springframework.security.core.Transient;
import org.springframework.security.oauth2.jwt.Jwt; import org.springframework.security.oauth2.jwt.Jwt;
/** /**
@ -32,7 +32,7 @@ import org.springframework.security.oauth2.jwt.Jwt;
* @see AbstractOAuth2TokenAuthenticationToken * @see AbstractOAuth2TokenAuthenticationToken
* @see Jwt * @see Jwt
*/ */
@TransientAuthentication @Transient
public class JwtAuthenticationToken extends AbstractOAuth2TokenAuthenticationToken<Jwt> { public class JwtAuthenticationToken extends AbstractOAuth2TokenAuthenticationToken<Jwt> {
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;

View File

@ -30,7 +30,7 @@ import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.security.authentication.AuthenticationTrustResolver; import org.springframework.security.authentication.AuthenticationTrustResolver;
import org.springframework.security.authentication.AuthenticationTrustResolverImpl; import org.springframework.security.authentication.AuthenticationTrustResolverImpl;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.TransientAuthentication; import org.springframework.security.core.Transient;
import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.context.SecurityContextHolderStrategy; import org.springframework.security.core.context.SecurityContextHolderStrategy;
@ -445,7 +445,7 @@ public class HttpSessionSecurityContextRepository implements SecurityContextRepo
} }
private boolean isTransientAuthentication(Authentication authentication) { private boolean isTransientAuthentication(Authentication authentication) {
return AnnotationUtils.getAnnotation(authentication.getClass(), TransientAuthentication.class) != null; return AnnotationUtils.getAnnotation(authentication.getClass(), Transient.class) != null;
} }
/** /**

View File

@ -37,7 +37,7 @@ import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.authentication.AuthenticationTrustResolver; import org.springframework.security.authentication.AuthenticationTrustResolver;
import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.authentication.TestingAuthenticationToken;
import org.springframework.security.core.TransientAuthentication; import org.springframework.security.core.Transient;
import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
@ -674,7 +674,7 @@ public class HttpSessionSecurityContextRepositoryTests {
assertThat(session).isNull(); assertThat(session).isNull();
} }
@TransientAuthentication @Transient
private static class SomeTransientAuthentication extends AbstractAuthenticationToken { private static class SomeTransientAuthentication extends AbstractAuthenticationToken {
public SomeTransientAuthentication() { public SomeTransientAuthentication() {
super(null); super(null);
@ -697,7 +697,7 @@ public class HttpSessionSecurityContextRepositoryTests {
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@TransientAuthentication @Transient
public @interface TestTransientAuthentication { public @interface TestTransientAuthentication {
} }