Search in sources :

Example 21 with ClientInitialAccessPresentation

use of org.keycloak.representations.idm.ClientInitialAccessPresentation in project keycloak by keycloak.

the class AbstractRegCliTest method issueInitialAccessToken.

String issueInitialAccessToken(String realm) {
    ClientInitialAccessResource resource = adminClient.realm(realm).clientInitialAccess();
    ClientInitialAccessCreatePresentation rep = new ClientInitialAccessCreatePresentation();
    rep.setCount(10);
    rep.setExpiration(100);
    ClientInitialAccessPresentation response = resource.create(rep);
    String token = response.getToken();
    Assert.assertNotNull("Issued initial access token not null", token);
    return token;
}
Also used : ClientInitialAccessResource(org.keycloak.admin.client.resource.ClientInitialAccessResource) ClientInitialAccessCreatePresentation(org.keycloak.representations.idm.ClientInitialAccessCreatePresentation) ClientInitialAccessPresentation(org.keycloak.representations.idm.ClientInitialAccessPresentation)

Example 22 with ClientInitialAccessPresentation

use of org.keycloak.representations.idm.ClientInitialAccessPresentation in project keycloak by keycloak.

the class AbstractClientPoliciesTest method setInitialAccessTokenForDynamicClientRegistration.

protected void setInitialAccessTokenForDynamicClientRegistration() {
    // get initial access token for Dynamic Client Registration with authentication
    reg = ClientRegistration.create().url(suiteContext.getAuthServerInfo().getContextRoot() + "/auth", REALM_NAME).build();
    ClientInitialAccessPresentation token = adminClient.realm(REALM_NAME).clientInitialAccess().create(new ClientInitialAccessCreatePresentation(0, 10));
    reg.auth(Auth.token(token));
}
Also used : ClientInitialAccessCreatePresentation(org.keycloak.representations.idm.ClientInitialAccessCreatePresentation) ClientInitialAccessPresentation(org.keycloak.representations.idm.ClientInitialAccessPresentation)

Aggregations

ClientInitialAccessPresentation (org.keycloak.representations.idm.ClientInitialAccessPresentation)22 ClientInitialAccessCreatePresentation (org.keycloak.representations.idm.ClientInitialAccessCreatePresentation)20 Test (org.junit.Test)9 ClientRepresentation (org.keycloak.representations.idm.ClientRepresentation)9 ClientRegistrationException (org.keycloak.client.registration.ClientRegistrationException)6 Before (org.junit.Before)5 ClientRegistration (org.keycloak.client.registration.ClientRegistration)3 JWSInput (org.keycloak.jose.jws.JWSInput)3 AuthServerContainerExclude (org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude)3 ClientInitialAccessResource (org.keycloak.admin.client.resource.ClientInitialAccessResource)2 JsonWebToken (org.keycloak.representations.JsonWebToken)2 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 Produces (javax.ws.rs.Produces)1 CoreMatchers.allOf (org.hamcrest.CoreMatchers.allOf)1 Matchers.greaterThanOrEqualTo (org.hamcrest.Matchers.greaterThanOrEqualTo)1 Matchers.lessThanOrEqualTo (org.hamcrest.Matchers.lessThanOrEqualTo)1 Assert.assertEquals (org.junit.Assert.assertEquals)1