diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/BearerTokenAuthenticationToken.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/BearerTokenAuthenticationToken.java index 9ba55a25554..839f93cace1 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/BearerTokenAuthenticationToken.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/BearerTokenAuthenticationToken.java @@ -47,7 +47,7 @@ public class BearerTokenAuthenticationToken extends AbstractAuthenticationToken */ public BearerTokenAuthenticationToken(String token) { super(Collections.emptyList()); - Assert.hasText(token, "token cannot be empty"); + Assert.notNull(token, "token cannot be null"); this.token = token; }