Example usage for org.springframework.security.oauth2.provider ClientRegistrationException ClientRegistrationException

List of usage examples for org.springframework.security.oauth2.provider ClientRegistrationException ClientRegistrationException

Introduction

In this page you can find the example usage for org.springframework.security.oauth2.provider ClientRegistrationException ClientRegistrationException.

Prototype

public ClientRegistrationException(String msg) 

Source Link

Usage

From source file:com.tlantic.integration.authentication.service.security.ClientDetailService.java

@Override
public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
    ClientDetail clientDetails = clientDetailsRepository.findByClientId(clientId);
    if (null == clientDetails) {
        throw new ClientRegistrationException("Client not found with id '" + clientId + "'");
    }//w  ww .ja v  a 2  s.com
    return getClientFromMongoDBClientDetails(clientDetails);
}

From source file:net.prasenjit.auth.service.ClientService.java

/**
 * {@inheritDoc}/*from www.  j a v a 2 s .c  om*/
 */
@Override
@Transactional(readOnly = true)
public Client loadClientByClientId(String clientId) throws ClientRegistrationException {
    Client client = clientRepository.findOne(clientId);
    if (client == null) {
        throw new ClientRegistrationException("Client '" + clientId + "' not found");
    }
    return client;
}

From source file:org.codenergic.theskeleton.client.impl.OAuth2ClientServiceImpl.java

@Override
@Transactional/*  w  w  w .  j av a  2  s. c  o  m*/
public void deleteClient(String id) {
    OAuth2ClientEntity o = findClientById(id).orElseThrow(() -> new ClientRegistrationException(id));
    clientRepository.delete(o);
}

From source file:org.codenergic.theskeleton.client.impl.OAuth2ClientServiceImpl.java

@Override
@Transactional//from  w  ww .  j ava 2s .  c  om
public OAuth2ClientEntity generateSecret(String clientId) {
    OAuth2ClientEntity client = findClientById(clientId)
            .orElseThrow(() -> new ClientRegistrationException(clientId));
    return generateSecret(client);
}

From source file:org.codenergic.theskeleton.client.impl.OAuth2ClientServiceImpl.java

@Override
public ClientDetails loadClientByClientId(String clientId) {
    return findClientById(clientId).orElseThrow(() -> new ClientRegistrationException(clientId));
}

From source file:org.codenergic.theskeleton.client.impl.OAuth2ClientServiceImpl.java

@Override
@Transactional//from   w w  w  .j av  a 2  s .  c o  m
public OAuth2ClientEntity updateClient(String clientId, OAuth2ClientEntity newClient) {
    return findClientById(clientId).orElseThrow(() -> new ClientRegistrationException(clientId))
            .setName(newClient.getName()).setDescription(newClient.getDescription())
            .setAuthorizedGrantTypes(newClient.getAuthorizedGrantTypes().stream().map(OAuth2GrantType::valueOf)
                    .collect(Collectors.toSet()))
            .setAutoApprove(newClient.isAutoApprove())
            .setRegisteredRedirectUris(newClient.getRegisteredRedirectUri());
}

From source file:org.infoscoop.api.oauth2.provider.ISClientDetailsService.java

@Override
public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
    OAuth2ProviderClientDetailDAO provider = OAuth2ProviderClientDetailDAO.newInstance();
    OAuth2ProviderClientDetail pcd = provider.getClientDetailById(clientId);

    if (pcd == null) {
        throw new ClientRegistrationException("Client Detail not set up.");
    }/* w  w  w  .ja v  a 2s .co m*/

    BaseClientDetails clientDetails = new BaseClientDetails(clientId, pcd.getResourceIds(), pcd.getScope(),
            pcd.getGrantTypes(), pcd.getAuthorities(), pcd.getRedirectUrl());
    clientDetails.setClientSecret(pcd.getSecret());

    return clientDetails;
}