|
@@ -18,6 +18,8 @@ package org.springframework.security.oauth2.core;
|
|
|
|
|
|
import java.time.Duration;
|
|
|
import java.time.Instant;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.HashSet;
|
|
|
|
|
|
/**
|
|
|
* @author Rob Winch
|
|
@@ -30,4 +32,12 @@ public class TestOAuth2AccessTokens {
|
|
|
Instant.now(),
|
|
|
Instant.now().plus(Duration.ofDays(1)));
|
|
|
}
|
|
|
+
|
|
|
+ public static OAuth2AccessToken scopes(String... scopes) {
|
|
|
+ return new OAuth2AccessToken(OAuth2AccessToken.TokenType.BEARER,
|
|
|
+ "scopes",
|
|
|
+ Instant.now(),
|
|
|
+ Instant.now().plus(Duration.ofDays(1)),
|
|
|
+ new HashSet<>(Arrays.asList(scopes)));
|
|
|
+ }
|
|
|
}
|