com.formkiq.server.service.OAuthService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of formkiq-server Show documentation
Show all versions of formkiq-server Show documentation
Server-side integration for the FormKiQ ios application
/*
* Copyright (C) 2016 FormKiQ Inc.
*
* 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 com.formkiq.server.service;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.oauth2.provider.ClientAlreadyExistsException;
import org.springframework.security.oauth2.provider.NoSuchClientException;
import com.formkiq.server.domain.type.ClientDTO;
import com.formkiq.server.domain.type.ClientListDTO;
/**
* Helper Service for OAuth.
*
*/
public interface OAuthService {
/**
* Adds Client Details.
* @param clientName {@link String}
* @param clientId {@link String}
* @param clientSecret {@link String}
* @throws ClientAlreadyExistsException ClientAlreadyExistsException
*/
void addClientDetails(String clientName, String clientId,
String clientSecret) throws ClientAlreadyExistsException;
/**
* Number of Clients.
* @return int
*/
int clientCount();
/**
* Deletes Client.
* @param clientid {@link String}
* @throws NoSuchClientException NoSuchClientException
*/
void deleteClient(String clientid) throws NoSuchClientException;
/**
* Finds Client User has access to.
* @param user {@link UserDetails}
* @param client {@link String}
* @return {@link ClientDTO}
*/
ClientDTO findClient(UserDetails user, String client);
/**
* Whether Client ID exists.
* @param clientid {@link String}
* @return boolean
*/
boolean isValidClient(String clientid);
/**
* Whether Client ID / Secret combination is valid.
* @param clientid {@link String}
* @param clientSecret {@link String}
* @return boolean
*/
boolean isValidClient(String clientid, String clientSecret);
/**
* List of all clients.
* @param token {@link String}
* @return FormGroupListDTO
*/
ClientListDTO list(String token);
/**
* Saves Client.
* @param clientName {@link String}
* @param clientId {@link String}
* @param clientSecret {@link String}
*/
void save(final String clientName, final String clientId,
final String clientSecret);
}