Commit dcb5da8a authored by Matija Obreza's avatar Matija Obreza

Merge branch 'ui-182-admin-oauth-client-management' into 'master'

Added listClientDetails by Page, fixed Json for OAuthClient#scopes

See merge request genesys-pgr/application-blocks!42
parents 431f9c7e 25f25188
...@@ -38,6 +38,7 @@ import javax.persistence.PreUpdate; ...@@ -38,6 +38,7 @@ import javax.persistence.PreUpdate;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.genesys.blocks.model.Copyable; import org.genesys.blocks.model.Copyable;
import org.genesys.blocks.model.JsonViews; import org.genesys.blocks.model.JsonViews;
...@@ -416,6 +417,7 @@ public class OAuthClient extends AclSid implements ClientDetails, Copyable<OAuth ...@@ -416,6 +417,7 @@ public class OAuthClient extends AclSid implements ClientDetails, Copyable<OAuth
* (non-Javadoc) * (non-Javadoc)
* @see org.springframework.security.oauth2.provider.ClientDetails#getScope() * @see org.springframework.security.oauth2.provider.ClientDetails#getScope()
*/ */
@JsonProperty("clientScopes")
@Override @Override
public Set<String> getScope() { public Set<String> getScope() {
return scopes; return scopes;
...@@ -426,6 +428,7 @@ public class OAuthClient extends AclSid implements ClientDetails, Copyable<OAuth ...@@ -426,6 +428,7 @@ public class OAuthClient extends AclSid implements ClientDetails, Copyable<OAuth
* *
* @param scopes the new scopes * @param scopes the new scopes
*/ */
@JsonProperty("clientScopes")
public void setScopes(Set<String> scopes) { public void setScopes(Set<String> scopes) {
this.scopes = scopes; this.scopes = scopes;
} }
......
...@@ -18,6 +18,8 @@ package org.genesys.blocks.oauth.service; ...@@ -18,6 +18,8 @@ package org.genesys.blocks.oauth.service;
import java.util.List; import java.util.List;
import org.genesys.blocks.oauth.model.OAuthClient; import org.genesys.blocks.oauth.model.OAuthClient;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.oauth2.provider.ClientDetailsService; import org.springframework.security.oauth2.provider.ClientDetailsService;
/** /**
...@@ -32,6 +34,13 @@ public interface OAuthClientDetailsService extends ClientDetailsService { ...@@ -32,6 +34,13 @@ public interface OAuthClientDetailsService extends ClientDetailsService {
*/ */
List<OAuthClient> listClientDetails(); List<OAuthClient> listClientDetails();
/**
* List client details.
*
* @return page with Client details
*/
Page<OAuthClient> listClientDetails(Pageable pageable);
/** /**
* Gets the client. * Gets the client.
* *
......
...@@ -40,7 +40,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -40,7 +40,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
...@@ -558,6 +560,11 @@ public class OAuthServiceImpl implements OAuthClientDetailsService, OAuthTokenSt ...@@ -558,6 +560,11 @@ public class OAuthServiceImpl implements OAuthClientDetailsService, OAuthTokenSt
return oauthClientRepository.findAll(new Sort("clientId")); return oauthClientRepository.findAll(new Sort("clientId"));
} }
@Override
public Page<OAuthClient> listClientDetails(Pageable pageable) {
return oauthClientRepository.findAll(pageable);
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see org.genesys.blocks.oauth.service.OAuthTokenStoreService# * @see org.genesys.blocks.oauth.service.OAuthTokenStoreService#
......
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