List of usage examples for org.springframework.security.oauth2.provider.client BaseClientDetails getClientId
@org.codehaus.jackson.annotate.JsonIgnore
@com.fasterxml.jackson.annotation.JsonIgnore
public String getClientId()
From source file:org.cloudfoundry.identity.uaa.api.client.impl.UaaClientOperationsImpl.java
public BaseClientDetails create(BaseClientDetails client) { Assert.notNull(client); Assert.hasText(client.getClientId()); return helper.post("/oauth/clients", client, CLIENT_REF); }
From source file:org.cloudfoundry.identity.uaa.api.client.impl.UaaClientOperationsImpl.java
public BaseClientDetails update(BaseClientDetails client) { Assert.notNull(client); Assert.hasText(client.getClientId()); return helper.put("/oauth/clients/{id}", client, CLIENT_REF, client.getClientId()); }
From source file:org.cloudfoundry.identity.uaa.api.client.test.UaaClientOperationTest.java
@Test public void testGetClient() throws Exception { ignoreIfUaaNotRunning();//from w w w.j av a 2 s . c om BaseClientDetails client = operations.findById("app"); assertEquals("ID wrong", "app", client.getClientId()); assertNull("Secret should not be returned", client.getClientSecret()); }
From source file:org.cloudfoundry.identity.uaa.api.client.test.UaaClientOperationTest.java
@Test public void testChangePassword() throws Exception { ignoreIfUaaNotRunning();/*from ww w .j ava2 s.c o m*/ BaseClientDetails client = operations.findById("admin"); operations.changeClientSecret(client.getClientId(), "adminsecret", "newSecret"); try { operations.changeClientSecret(client.getClientId(), "adminsecret", "shouldfail"); fail("First password change failed"); } catch (Exception e) { } finally { operations.changeClientSecret(client.getClientId(), "newSecret", "adminsecret"); } }
From source file:org.cloudfoundry.identity.uaa.api.client.test.UaaClientOperationTest.java
@Test public void testCreateDelete() throws Exception { ignoreIfUaaNotRunning();//ww w . ja v a 2 s . c om BaseClientDetails client = createClient(); BaseClientDetails checkClient = operations.findById(client.getClientId()); assertEquals(client.getClientId(), checkClient.getClientId()); operations.delete(client.getClientId()); }
From source file:org.cloudfoundry.identity.uaa.api.client.test.UaaClientOperationTest.java
@Test public void testUpdate() throws Exception { ignoreIfUaaNotRunning();/* w w w . j a v a2 s . c om*/ BaseClientDetails toUpdate = createClient(); try { BaseClientDetails client = operations.findById(toUpdate.getClientId()); toUpdate.setScope(Arrays.asList("foo")); BaseClientDetails updated = operations.update(toUpdate); assertNotEquals(client.getScope(), updated.getScope()); assertEquals("foo", updated.getScope().iterator().next()); } finally { operations.delete(toUpdate.getClientId()); } }
From source file:org.cloudfoundry.identity.uaa.integration.util.IntegrationTestUtils.java
public static BaseClientDetails updateClient(RestTemplate template, String url, BaseClientDetails client) throws Exception { ResponseEntity<BaseClientDetails> response = template.exchange(url + "/oauth/clients/{clientId}", HttpMethod.PUT, new HttpEntity<>(client), BaseClientDetails.class, client.getClientId()); return response.getBody(); }
From source file:com.cedac.security.oauth2.provider.client.MongoClientDetailsServiceTests.java
@Test(expected = NoSuchClientException.class) public void testRemoveNonExistentClient() { BaseClientDetails clientDetails = new BaseClientDetails(); clientDetails.setClientId("nosuchClientIdWithNoDetails"); fixture.removeClientDetails(clientDetails.getClientId()); }
From source file:com.cedac.security.oauth2.provider.client.MongoClientDetailsServiceTests.java
@Test public void testRemoveClient() { BaseClientDetails clientDetails = new BaseClientDetails(); clientDetails.setClientId("deletedClientIdWithNoDetails"); fixture.addClientDetails(clientDetails); fixture.removeClientDetails(clientDetails.getClientId()); long count = collection.count(new BasicDBObject("clientId", "deletedClientIdWithNoDetails")); assertEquals(0, count);//from w ww . jav a2 s . c om }
From source file:com.example.ClientDetailsController.java
@PostMapping("/clients") public String add(Principal user) { BaseClientDetails client = new BaseClientDetails(strings.generate(), null, "openid,cloud_controller.read,cloud_controller.write", "password,authorization_code,refresh_token", "ROLE_CLIENT"); client.setClientSecret(strings.generate()); client.setAutoApproveScopes(Arrays.asList("true")); clients.addClientDetails(client);// w w w. j av a2s.c o m template.update("INSERT into user_client_details (username, client_id) values (?,?)", user.getName(), client.getClientId()); return "redirect:/clients"; }