Codota Logo
ClientAlreadyExistsException
Code IndexAdd Codota to your IDE (free)

How to use
ClientAlreadyExistsException
in
org.springframework.security.oauth2.provider

Best Java code snippets using org.springframework.security.oauth2.provider.ClientAlreadyExistsException (Showing top 14 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-security-oauth

public void addClientDetails(ClientDetails clientDetails) throws ClientAlreadyExistsException {
  try {
    jdbcTemplate.update(insertClientDetailsSql, getFields(clientDetails));
  }
  catch (DuplicateKeyException e) {
    throw new ClientAlreadyExistsException("Client already exists: " + clientDetails.getClientId(), e);
  }
}
origin: cloudfoundry/uaa

@ExceptionHandler(ClientAlreadyExistsException.class)
public ResponseEntity<InvalidClientDetailsException> handleClientAlreadyExists(ClientAlreadyExistsException e) {
  return new ResponseEntity<>(new InvalidClientDetailsException(e.getMessage()),
                HttpStatus.CONFLICT);
}
origin: cloudfoundry/uaa

@Override
public void addClientDetails(ClientDetails clientDetails, String zoneId) throws ClientAlreadyExistsException {
  try {
    jdbcTemplate.update(DEFAULT_INSERT_STATEMENT, getInsertClientDetailsFields(clientDetails, zoneId));
  } catch (DuplicateKeyException e) {
    throw new ClientAlreadyExistsException("Client already exists: " + clientDetails.getClientId(), e);
  }
}
origin: cloudfoundry/uaa

@ExceptionHandler(ClientAlreadyExistsException.class)
public ResponseEntity<InvalidClientDetailsException> handleClientAlreadyExists(ClientAlreadyExistsException e) {
  incrementErrorCounts(e);
  return new ResponseEntity<>(new InvalidClientDetailsException(e.getMessage()),
          HttpStatus.CONFLICT);
}
origin: cloudfoundry/uaa

@Test
public void testHandleClientAlreadyExists() throws Exception {
  ResponseEntity<InvalidClientDetailsException> result = endpoints
    .handleClientAlreadyExists(new ClientAlreadyExistsException("No such client: foo"));
  assertEquals(HttpStatus.CONFLICT, result.getStatusCode());
}
origin: cloudfoundry/uaa

logger.debug(e.getMessage());
origin: cloudfoundry/uaa

@Test
public void testOverrideClientWithEmptySecret() throws Exception {
  ClientMetadataProvisioning clientMetadataProvisioning = mock(ClientMetadataProvisioning.class);
  bootstrap.setClientMetadataProvisioning(clientMetadataProvisioning);
  BaseClientDetails foo = new BaseClientDetails("foo", "", "openid", "client_credentials,password", "uaa.none");
  foo.setClientSecret("secret");
  clientRegistrationService.addClientDetails(foo);
  reset(clientRegistrationService);
  Map<String, Object> map = new HashMap<>();
  map.put("secret", null);
  map.put("override", true);
  map.put("authorized-grant-types", "client_credentials");
  bootstrap.setClients(Collections.singletonMap("foo", map));
  when(clientMetadataProvisioning.update(any(ClientMetadata.class), anyString())).thenReturn(new ClientMetadata());
  doThrow(new ClientAlreadyExistsException("Planned"))
    .when(clientRegistrationService).addClientDetails(any(ClientDetails.class), anyString());
  bootstrap.afterPropertiesSet();
  verify(clientRegistrationService, times(1)).addClientDetails(any(ClientDetails.class), anyString());
  ArgumentCaptor<ClientDetails> captor = ArgumentCaptor.forClass(ClientDetails.class);
  verify(clientRegistrationService, times(1)).updateClientDetails(captor.capture(), anyString());
  verify(clientRegistrationService, times(1)).updateClientSecret("foo", "", IdentityZoneHolder.get().getId());
  assertEquals(new HashSet(Arrays.asList("client_credentials")), captor.getValue().getAuthorizedGrantTypes());
}
origin: cloudfoundry/uaa

@Test
public void testOverrideClient() throws Exception {
  ClientMetadataProvisioning clientMetadataProvisioning = mock(ClientMetadataProvisioning.class);
  bootstrap.setClientMetadataProvisioning(clientMetadataProvisioning);
  BaseClientDetails foo = new BaseClientDetails("foo", "", "openid", "client_credentials,password", "uaa.none");
  foo.setClientSecret("secret");
  clientRegistrationService.addClientDetails(foo);
  reset(clientRegistrationService);
  Map<String, Object> map = new HashMap<>();
  map.put("secret", "bar");
  map.put("override", true);
  map.put("authorized-grant-types", "client_credentials");
  bootstrap.setClients(Collections.singletonMap("foo", map));
  when(clientMetadataProvisioning.update(any(ClientMetadata.class), anyString())).thenReturn(new ClientMetadata());
  doThrow(new ClientAlreadyExistsException("Planned"))
    .when(clientRegistrationService).addClientDetails(any(ClientDetails.class), anyString());
  bootstrap.afterPropertiesSet();
  verify(clientRegistrationService, times(1)).addClientDetails(any(ClientDetails.class), anyString());
  ArgumentCaptor<ClientDetails> captor = ArgumentCaptor.forClass(ClientDetails.class);
  verify(clientRegistrationService, times(1)).updateClientDetails(captor.capture(), anyString());
  verify(clientRegistrationService, times(1)).updateClientSecret("foo", "bar", IdentityZoneHolder.get().getId());
  assertEquals(new HashSet(Arrays.asList("client_credentials")), captor.getValue().getAuthorizedGrantTypes());
}
origin: cloudfoundry/uaa

@Test
public void testOverrideClientByDefault() throws Exception {
  ClientMetadataProvisioning clientMetadataProvisioning = mock(ClientMetadataProvisioning.class);
  bootstrap.setClientMetadataProvisioning(clientMetadataProvisioning);
  BaseClientDetails foo = new BaseClientDetails("foo", "", "openid", "client_credentials,password", "uaa.none");
  foo.setClientSecret("secret");
  clientRegistrationService.addClientDetails(foo);
  reset(clientRegistrationService);
  Map<String, Object> map = new HashMap<>();
  map.put("secret", "bar");
  map.put("redirect-uri", "http://localhost/callback");
  map.put("authorized-grant-types","client_credentials");
  bootstrap.setClients(Collections.singletonMap("foo", map));
  when(clientMetadataProvisioning.update(any(ClientMetadata.class), anyString())).thenReturn(new ClientMetadata());
  doThrow(new ClientAlreadyExistsException("Planned")).when(clientRegistrationService)
    .addClientDetails(
      any(ClientDetails.class),
      anyString()
    );
  bootstrap.afterPropertiesSet();
  verify(clientRegistrationService, times(1)).addClientDetails(any(ClientDetails.class), anyString());
  verify(clientRegistrationService, times(1)).updateClientDetails(any(ClientDetails.class), anyString());
  verify(clientRegistrationService, times(1)).updateClientSecret("foo", "bar", IdentityZoneHolder.get().getId());
}
origin: cloudfoundry/uaa

doThrow(new ClientAlreadyExistsException("Planned")).when(clientRegistrationService).addClientDetails(
        any(ClientDetails.class), anyString());
bootstrap.afterPropertiesSet();
origin: org.springframework.security.oauth/spring-security-oauth2

public void addClientDetails(ClientDetails clientDetails) throws ClientAlreadyExistsException {
  try {
    jdbcTemplate.update(insertClientDetailsSql, getFields(clientDetails));
  }
  catch (DuplicateKeyException e) {
    throw new ClientAlreadyExistsException("Client already exists: " + clientDetails.getClientId(), e);
  }
}
origin: fangchunzao/SpringSecurityOauth2

public void addClientDetails(ClientDetails clientDetails) throws ClientAlreadyExistsException {
  try {
    this.jdbcTemplate.update(this.insertClientDetailsSql, this.getFields(clientDetails));
  } catch (DuplicateKeyException var3) {
    throw new ClientAlreadyExistsException("Client already exists: " + clientDetails.getClientId(), var3);
  }
}
origin: yuequan1997/watchdog-spring-boot-starter

@Override
public void addClientDetails(ClientDetails clientDetails) throws ClientAlreadyExistsException {
  if(applicationRepository.findByClientId(clientDetails.getClientId()).isPresent()){
    throw new ClientAlreadyExistsException("The client already exists");
  }
  applicationRepository.save(clientDetails);
}
origin: leecho/cola-cloud

@Transactional(rollbackFor = Exception.class)
@CachePut(value = OAUTH_CLINET_DETAILS_CACHE, key = "#clientDetails.clientId")
public ClientDetails addClientDetailsWithCache(ClientDetails clientDetails) throws ClientAlreadyExistsException {
  if (this.clientService.findOneByColumn("client_id", clientDetails.getClientId()) != null) {
    throw new ClientAlreadyExistsException("Client ID already exists");
  }
  Client client = Client.builder()
      .clientId(clientDetails.getClientId())
      .clientSecret(clientDetails.getClientSecret())
      .accessTokenValiditySeconds(clientDetails.getAccessTokenValiditySeconds())
      .refreshTokenValiditySeconds(clientDetails.getRefreshTokenValiditySeconds()).build();
  client.setGrantType(clientDetails.getAuthorizedGrantTypes().stream().collect(Collectors.joining(",")));
  client.setRedirectUri(clientDetails.getRegisteredRedirectUri().stream().collect(Collectors.joining(",")));
  clientService.insert(client);
  List<Scope> clientScopes = clientDetails.getScope().stream().map(scope ->
      Scope.builder().clientId(client.getId()).autoApprove(false).scope(scope).build()).collect(Collectors.toList());
  this.scopeService.insertBatch(clientScopes);
  return clientDetails;
}
org.springframework.security.oauth2.providerClientAlreadyExistsException

Javadoc

Exception indicating that a client registration already exists (e.g. if someone tries to create a duplicate).

Most used methods

  • <init>
  • getMessage

Popular in Java

  • Reactive rest calls using spring rest template
  • addToBackStack (FragmentTransaction)
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • Collectors (java.util.stream)
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now