forked from loafle/openapi-generator-original
Playframework oauth small upgrade (#12332)
* update surefire to newer version * small tweak to add support for "leeway" when verifying oauth tokens. Co-authored-by: William Cheng <wing328hk@gmail.com> Co-authored-by: Bruno Flamand <bflamand@stingray.com>
This commit is contained in:
parent
6931f15e80
commit
575b6b4330
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
{{#hasOAuthMethods}}
|
||||
{{#oauthMethods}}
|
||||
@ -135,6 +137,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
tokenIntrospectEndpoints.put("petstore_auth", "");
|
||||
|
||||
@ -127,6 +129,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
tokenIntrospectEndpoints.put("petstore_auth", "");
|
||||
|
||||
@ -127,6 +129,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
tokenIntrospectEndpoints.put("petstore_auth", "");
|
||||
|
||||
@ -127,6 +129,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
tokenIntrospectEndpoints.put("petstore_token", "https://keycloak-dev.business.stingray.com/auth/realms/CSLocal/protocol/openid-connect/token/introspect");
|
||||
|
||||
@ -127,6 +129,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
tokenIntrospectEndpoints.put("petstore_auth", "");
|
||||
|
||||
@ -127,6 +129,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
tokenIntrospectEndpoints.put("petstore_auth", "");
|
||||
|
||||
@ -127,6 +129,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
tokenIntrospectEndpoints.put("petstore_auth", "");
|
||||
|
||||
@ -127,6 +129,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
tokenIntrospectEndpoints.put("petstore_auth", "");
|
||||
|
||||
@ -127,6 +129,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
tokenIntrospectEndpoints.put("petstore_auth", "");
|
||||
|
||||
@ -127,6 +129,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
tokenIntrospectEndpoints.put("petstore_auth", "");
|
||||
|
||||
@ -127,6 +129,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
tokenIntrospectEndpoints.put("petstore_auth", "");
|
||||
|
||||
@ -127,6 +129,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class SecurityAPIUtils {
|
||||
private final HashMap<String, String> tokenIntrospectEndpoints = new HashMap<>();
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final long leeway;
|
||||
|
||||
// Offline validation
|
||||
private final HashMap<String, String> jwksEndpoints = new HashMap<>();
|
||||
@ -54,6 +55,7 @@ public class SecurityAPIUtils {
|
||||
|
||||
clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : "";
|
||||
clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : "";
|
||||
leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3;
|
||||
|
||||
tokenIntrospectEndpoints.put("petstore_auth", "");
|
||||
|
||||
@ -127,6 +129,7 @@ public class SecurityAPIUtils {
|
||||
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);
|
||||
tokenVerifier = JWT.require(algorithm)
|
||||
.withIssuer(issuer)
|
||||
.acceptLeeway(leeway)
|
||||
.build();
|
||||
tokenKeyId = keyId;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user