use of org.keycloak.adapters.authentication.JWTClientSecretCredentialsProvider in project keycloak by keycloak.
the class ClientAuthSecretSignedJWTTest method getClientSignedJWT.
private String getClientSignedJWT(String secret, int timeout, String algorithm) {
JWTClientSecretCredentialsProvider jwtProvider = new JWTClientSecretCredentialsProvider();
jwtProvider.setClientSecret(secret, algorithm);
return jwtProvider.createSignedRequestToken(oauth.getClientId(), getRealmInfoUrl(), algorithm);
}
use of org.keycloak.adapters.authentication.JWTClientSecretCredentialsProvider in project keycloak by keycloak.
the class FAPI1Test method getClientSecretSignedJWT.
private String getClientSecretSignedJWT(String secret, String algorithm) {
JWTClientSecretCredentialsProvider jwtProvider = new JWTClientSecretCredentialsProvider();
jwtProvider.setClientSecret(secret, algorithm);
return jwtProvider.createSignedRequestToken(oauth.getClientId(), getRealmInfoUrl(), algorithm);
}
use of org.keycloak.adapters.authentication.JWTClientSecretCredentialsProvider in project keycloak by keycloak.
the class ClientAuthSecretSignedJWTTest method testInvalidIssuer.
@Test
public void testInvalidIssuer() throws Exception {
oauth.clientId("test-app");
oauth.doLogin("test-user@localhost", "password");
String code = oauth.getCurrentQuery().get(OAuth2Constants.CODE);
JWTClientSecretCredentialsProvider jwtProvider = new JWTClientSecretCredentialsProvider() {
@Override
protected JsonWebToken createRequestToken(String clientId, String realmInfoUrl) {
JsonWebToken jwt = super.createRequestToken(clientId, realmInfoUrl);
jwt.issuer("bad-issuer");
return jwt;
}
};
String algorithm = Algorithm.HS256;
jwtProvider.setClientSecret("password", algorithm);
String jwt = jwtProvider.createSignedRequestToken(oauth.getClientId(), getRealmInfoUrl(), algorithm);
OAuthClient.AccessTokenResponse response = doAccessTokenRequest(code, jwt);
assertEquals(400, response.getStatusCode());
assertEquals("invalid_client", response.getError());
}
Aggregations