use of org.gluu.oxauth.model.registration.Client in project oxAuth by GluuFederation.
the class CleanerTimerTest method client_whichIsNotExpiredAndDeletable_MustNotBeRemoved.
@Test
public void client_whichIsNotExpiredAndDeletable_MustNotBeRemoved() throws StringEncrypter.EncryptionException {
// 1. create client
final Client client = createClient(true);
clientService.persist(client);
// 2. client is in persistence
assertNotNull(clientService.getClient(client.getClientId()));
// 3. clean up
cleanerTimer.processImpl();
cacheService.clear();
// 4. client is in persistence (not removed)
assertNotNull(clientService.getClient(client.getClientId()));
}
use of org.gluu.oxauth.model.registration.Client in project oxAuth by GluuFederation.
the class CacheGrantManual method testClient.
private static Client testClient() {
Client client = new Client();
client.setClientId(UUID.randomUUID().toString());
return client;
}
use of org.gluu.oxauth.model.registration.Client in project oxAuth by GluuFederation.
the class Manual method getGroupsFromClient.
@Test
public void getGroupsFromClient() {
final Client client = MANAGER.find(Client.class, "inum=@!0000!0008!7652.0000,ou=clients,o=gluu");
System.out.println(client);
}
use of org.gluu.oxauth.model.registration.Client in project oxAuth by GluuFederation.
the class CleanUpClientTest method cleanUpClient.
@Test
@Parameters(value = "usedClients")
public void cleanUpClient(String usedClients) {
Assert.assertNotNull(usedClients);
List<String> usedClientsList = Arrays.asList(StringHelper.split(usedClients, ",", true, false));
output("Used clients: " + usedClientsList);
int clientsResultSetSize = 50;
int countResults = 0;
int countRemoved = 0;
boolean existsMoreClients = true;
while (existsMoreClients && countResults < 10000) {
List<Client> clients = clientService.getAllClients(new String[] { "inum" }, clientsResultSetSize);
existsMoreClients = clients.size() == clientsResultSetSize;
countResults += clients.size();
Assert.assertNotNull(clients);
output("Found clients: " + clients.size());
output("Total clients: " + countResults);
for (Client client : clients) {
String clientId = client.getClientId();
if (!usedClientsList.contains(clientId)) {
try {
clientService.remove(client);
} catch (EntryPersistenceException ex) {
output("Failed to remove client: " + ex.getMessage());
}
countRemoved++;
}
}
}
output("Removed clients: " + countRemoved);
}
use of org.gluu.oxauth.model.registration.Client in project oxAuth by GluuFederation.
the class RedirectionUriService method validatePostLogoutRedirectUri.
public String validatePostLogoutRedirectUri(String clientId, String postLogoutRedirectUri) {
boolean isBlank = Util.isNullOrEmpty(postLogoutRedirectUri);
Client client = clientService.getClient(clientId);
if (client != null) {
String[] postLogoutRedirectUris = client.getPostLogoutRedirectUris();
log.debug("Validating post logout redirect URI: clientId = {}, postLogoutRedirectUri = {}", clientId, postLogoutRedirectUri);
return validatePostLogoutRedirectUri(postLogoutRedirectUri, postLogoutRedirectUris);
}
if (!isBlank) {
throw errorResponseFactory.createWebApplicationException(Response.Status.BAD_REQUEST, EndSessionErrorResponseType.POST_LOGOUT_URI_NOT_ASSOCIATED_WITH_CLIENT, "`post_logout_redirect_uri` is not added to associated client.");
}
return null;
}
Aggregations