mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-05-31 09:12:14 +00:00
Add scopes method to TestOAuth2AccessTokens
Issue: gh-6025
This commit is contained in:
parent
f6414e9a52
commit
39933b10ff
@ -18,6 +18,8 @@ package org.springframework.security.oauth2.core;
|
|||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rob Winch
|
* @author Rob Winch
|
||||||
@ -30,4 +32,12 @@ public class TestOAuth2AccessTokens {
|
|||||||
Instant.now(),
|
Instant.now(),
|
||||||
Instant.now().plus(Duration.ofDays(1)));
|
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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user