use of org.keycloak.representations.idm.ClientInitialAccessCreatePresentation in project keycloak by keycloak.
the class OIDCClientRegistrationTest method before.
@Before
public void before() throws Exception {
super.before();
ClientInitialAccessPresentation token = adminClient.realm(REALM_NAME).clientInitialAccess().create(new ClientInitialAccessCreatePresentation(0, 10));
reg.auth(Auth.token(token));
}
use of org.keycloak.representations.idm.ClientInitialAccessCreatePresentation in project keycloak by keycloak.
the class OIDCJwksClientRegistrationTest method before.
@Before
public void before() throws Exception {
super.before();
ClientInitialAccessPresentation token = adminClient.realm(REALM_NAME).clientInitialAccess().create(new ClientInitialAccessCreatePresentation(0, 10));
reg.auth(Auth.token(token));
}
use of org.keycloak.representations.idm.ClientInitialAccessCreatePresentation in project keycloak by keycloak.
the class InitialAccessTokenResourceTest method testPeriodicExpiration.
@Test
public void testPeriodicExpiration() throws ClientRegistrationException, InterruptedException {
ClientInitialAccessPresentation response1 = resource.create(new ClientInitialAccessCreatePresentation(1, 1));
ClientInitialAccessPresentation response2 = resource.create(new ClientInitialAccessCreatePresentation(1000, 1));
ClientInitialAccessPresentation response3 = resource.create(new ClientInitialAccessCreatePresentation(1000, 0));
ClientInitialAccessPresentation response4 = resource.create(new ClientInitialAccessCreatePresentation(0, 1));
List<ClientInitialAccessPresentation> list = resource.list();
assertEquals(4, list.size());
setTimeOffset(10);
testingClient.testing().removeExpired(REALM_NAME);
list = resource.list();
assertEquals(2, list.size());
List<String> remainingIds = list.stream().map(initialAccessPresentation -> initialAccessPresentation.getId()).collect(Collectors.toList());
Assert.assertNames(remainingIds, response2.getId(), response4.getId());
setTimeOffset(2000);
testingClient.testing().removeExpired(REALM_NAME);
list = resource.list();
assertEquals(1, list.size());
Assert.assertEquals(list.get(0).getId(), response4.getId());
// Cleanup
realm.clientInitialAccess().delete(response4.getId());
}
use of org.keycloak.representations.idm.ClientInitialAccessCreatePresentation 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;
}
use of org.keycloak.representations.idm.ClientInitialAccessCreatePresentation 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));
}
Aggregations