[ANY] OpenID validate issuer and aud

This commit is contained in:
d3coder 2024-04-25 15:36:38 +05:00
parent 52c9196dcc
commit 26001a89f4
2 changed files with 6 additions and 2 deletions
LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/openid

View file

@ -36,7 +36,10 @@ public class OpenIDAuthenticator {
public OpenIDAuthenticator(OpenIDConfig openIDConfig) {
this.openIDConfig = openIDConfig;
var keyLocator = loadKeyLocator(openIDConfig);
this.jwtParser = Jwts.parser().keyLocator(keyLocator)
this.jwtParser = Jwts.parser()
.keyLocator(keyLocator)
.requireIssuer(openIDConfig.issuer())
.requireAudience(openIDConfig.clientId())
.build();
}

View file

@ -3,7 +3,8 @@
import java.net.URI;
public record OpenIDConfig(URI tokenUri, String authorizationEndpoint, String clientId, String clientSecret,
String redirectUri, URI jwksUri, String scopes, ClaimExtractorConfig extractorConfig) {
String redirectUri, URI jwksUri, String scopes, String issuer,
ClaimExtractorConfig extractorConfig) {
public record ClaimExtractorConfig(String usernameClaim, String uuidClaim) {}
}