Commit 8b91b0a6 authored by Matija Obreza's avatar Matija Obreza
Browse files

OAuth client management methods

parent bb5363a0
......@@ -18,17 +18,19 @@ package org.genesys.blocks.oauth.service;
import java.util.List;
import org.genesys.blocks.oauth.model.OAuthClient;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.ClientDetailsService;
public interface OAuthClientDetailsService extends ClientDetailsService {
List<OAuthClient> listClientDetails();
void removeClient(ClientDetails clientDetails);
OAuthClient getClient(String clientId);
OAuthClient addClient(String title, String description, String redirectUris, Integer accessTokenValiditySeconds, Integer refreshTokenValiditySeconds);
OAuthClient updateClient(long id, int version, OAuthClient updates);
OAuthClient removeClient(OAuthClient oauthClient);
}
......@@ -386,12 +386,17 @@ public class OAuthServiceImpl implements OAuthClientDetailsService, OAuthTokenSt
public List<AccessToken> findTokensByUserUuid(String uuid) {
return accessTokenRepository.findByUsername(uuid);
}
@Override
public OAuthClient getClient(String clientId) {
return oauthClientRepository.findByClientId(clientId);
}
@Override
@Transactional
public void removeClient(ClientDetails clientDetails) {
OAuthClient client = oauthClientRepository.findByClientId(clientDetails.getClientId());
public OAuthClient removeClient(OAuthClient client) {
oauthClientRepository.delete(client);
return client;
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment