All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.genesys.blocks.oauth.service.OAuthClientService Maven / Gradle / Ivy

There is a newer version: 5.6
Show newest version
/*
 * Copyright 2018 Global Crop Diversity Trust
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.genesys.blocks.oauth.service;

import java.util.List;

import com.querydsl.core.types.Predicate;
import org.genesys.blocks.oauth.model.OAuthClient;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository;

/**
 * The Interface OAuthClientDetailsService.
 */
public interface OAuthClientService extends RegisteredClientRepository {

	/**
	 * List client details.
	 *
	 * @return the list
	 */
	List listClientDetails();

	/**
	 * List client details.
	 *
	 * @param pageable the pageable
	 * @return page with Client details
	 */
	Page listClientDetails(Pageable pageable);

	/**
	 * List client details with filtering by predicate.
	 *
	 * @param predicate the predicate
	 * @param pageable the pageable
	 * @return page with Client details
	 */
	Page listClientDetails(Predicate predicate, Pageable pageable);

	/**
	 * Gets the client.
	 *
	 * @param clientId the client id
	 * @return the client
	 */
	OAuthClient getClient(String clientId);

	/**
	 * Register a new OAuth client.
	 *
	 * @param client the client
	 * @return the OAuth client
	 * @since 1.3
	 */
	OAuthClient addClient(OAuthClient client);

	/**
	 * Update client.
	 *
	 * @param id the id
	 * @param version the version
	 * @param updates the updates
	 * @return the o auth client
	 */
	OAuthClient updateClient(long id, int version, OAuthClient updates);

	/**
	 * Update clientId.
	 *
	 * @param sourceId the source clientId
	 * @param targetId the target clientId
	 *
	 * @return the o auth client
	 */
	OAuthClient updateClientId(String sourceId, String targetId);

	/**
	 * Removes the client.
	 *
	 * @param oauthClient the oauth client
	 * @return the o auth client
	 */
	OAuthClient removeClient(OAuthClient oauthClient);

	/**
	 * Autocomplete OAuth clients by title.
	 *
	 * @param title the title
	 * @param limit maximum number of results
	 * @return list of auth clients
	 */
	List autocompleteClients(String title, int limit);

	/**
	 * Generates a new clientSecret.
	 *
	 * @param oauthClient the client to regenerate secret for
	 * @return the new client secret
	 */
	String resetSecret(OAuthClient oauthClient);

	/**
	 * Sets a new clientSecret.
	 *
	 * @param oauthClient the client to set a secret for
	 * @param clientSecret the client secret
	 * @return the new client secret
	 */
	String setSecret(OAuthClient oauthClient, String clientSecret);

	/**
	 * Removes the Client secret.
	 *
	 * @param oauthClient the oauth client
	 * @return Updated OAuth client
	 */
	OAuthClient removeSecret(OAuthClient oauthClient);

	/**
	 * Check if the origin is registered with one of the clients
	 * 
	 * @param origin the origin
	 * @return true if a client exists with this origin, false otherwise 
	 */
	boolean isOriginRegistered(String origin);

	/**
	 * Load client by {@code clientId}.
	 * 
	 * @param clientId the client ID
	 * @return fully loaded {@code OAuthClient} or {@code null} if client is not found.
	 */
	OAuthClient loadClientByClientId(String clientId);

	/**
	 * Check OAuthClient.active.
	 *
	 * @param clientId the client id
	 * @return true if client is present and active
	 */
	boolean isClientActive(String clientId);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy