Add scopes method to TestOAuth2AccessTokens

Issue: gh-6025
This commit is contained in:
Josh Cummings 2018-11-19 18:06:40 -07:00
parent f6414e9a52
commit 39933b10ff
No known key found for this signature in database
GPG Key ID: 49EF60DD7FF83443

View File

@ -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)));
}
}