Skip to content

Validate Client with BBDD instead of InMemory info #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LORJIM opened this issue Apr 24, 2021 · 2 comments
Closed

Validate Client with BBDD instead of InMemory info #282

LORJIM opened this issue Apr 24, 2021 · 2 comments
Assignees
Labels
status: duplicate A duplicate of another issue

Comments

@LORJIM
Copy link

LORJIM commented Apr 24, 2021

Hi,

I'm not sure if this feature is already implemented on the project, but so far i didn't found anything about it.
Basically there is no "elegant" way of configuring a ClientDetailsService so we use the clients on the database instead of creating a InMemoryRegisteredClientRepository.

By my point of view, it should be something like in the previous versions of AuthorizationServer:

We have this on the AuthorizationServerConfig:

@Override
public void configure(ClientDetailsServiceConfigurer configurer) throws Exception {
    configurer.withClientDetails(couchbaseClientDetailsService);
}

And then in the service we have:

@service
public class CouchbaseClientDetailsService implements ClientDetailsService {

@Autowired
private CustomClientDetailsRepository customClientDetailsRepository;

@Override
public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {

    CustomClientDetails client = customClientDetailsRepository.findByClientId(clientId);

    String resourceIds = client.getResourceIds().stream().collect(Collectors.joining(","));
    String scopes = client.getScope().stream().collect(Collectors.joining(","));
    String grantTypes = client.getAuthorizedGrantTypes().stream().collect(Collectors.joining(","));
    String authorities = client.getAuthorities().stream().collect(Collectors.joining(","));

    BaseClientDetails base = new BaseClientDetails(client.getClientId(), resourceIds, scopes, grantTypes, authorities);
    base.setClientSecret(client.getClientSecret());
    base.setAccessTokenValiditySeconds(client.getAccessTokenValiditySeconds());
    base.setRefreshTokenValiditySeconds(client.getRefreshTokenValiditySeconds());
    base.setAdditionalInformation(client.getAdditionalInformation());
    base.setAutoApproveScopes(client.getScope());
    return base;
}

}

It's behavior would be similar of what we're used to do on a UserDetailsService, but with client.

As i said before, i don't know if there's a way to do this already on the project, if it is, please tell me and i apologize.

Thank you for the hard work.

@LORJIM LORJIM added the type: enhancement A general enhancement label Apr 24, 2021
@jgrandja
Copy link
Collaborator

@LORJIM A JDBC implementation of RegisteredClientRepository is coming in the 0.1.2 release. See gh-265.

Closing as duplicate.

@jgrandja jgrandja self-assigned this Apr 27, 2021
@jgrandja jgrandja added status: duplicate A duplicate of another issue and removed type: enhancement A general enhancement labels Apr 27, 2021
@jamesdube
Copy link

Is there a way to set additional information on the Registered client?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants