Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete clients from manifest upon startup.
Because client delete is a 'chain of events' such as deleting approvals and tokens. This operation happens after the context has started up, so that the event can propagate [#142056541] https://www.pivotaltracker.com/story/show/142056541
- Loading branch information
Showing
8 changed files
with
328 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
server/src/main/java/org/cloudfoundry/identity/uaa/authentication/SystemAuthentication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* **************************************************************************** | ||
* Cloud Foundry | ||
* Copyright (c) [2009-2017] Pivotal Software, Inc. All Rights Reserved. | ||
* | ||
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this product except in compliance with the License. | ||
* | ||
* This product includes a number of subcomponents with | ||
* separate copyright notices and license terms. Your use of these | ||
* subcomponents is subject to the terms and conditions of the | ||
* subcomponent's license, as noted in the LICENSE file. | ||
* **************************************************************************** | ||
*/ | ||
|
||
package org.cloudfoundry.identity.uaa.authentication; | ||
|
||
import org.springframework.security.core.Authentication; | ||
import org.springframework.security.core.GrantedAuthority; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
|
||
public class SystemAuthentication implements Authentication { | ||
|
||
public static final SystemAuthentication SYSTEM_AUTHENTICATION = new SystemAuthentication(); | ||
|
||
protected static final String PRINCIPAL = "uaa-system"; | ||
|
||
private SystemAuthentication() { | ||
} | ||
|
||
@Override | ||
public Collection<? extends GrantedAuthority> getAuthorities() { | ||
return Collections.emptyList(); | ||
} | ||
|
||
@Override | ||
public Object getCredentials() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Object getDetails() { | ||
return PRINCIPAL; | ||
} | ||
|
||
@Override | ||
public Object getPrincipal() { | ||
return PRINCIPAL; | ||
} | ||
|
||
@Override | ||
public boolean isAuthenticated() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { | ||
|
||
} | ||
|
||
@Override | ||
public String getName() { | ||
return PRINCIPAL; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
.../src/test/java/org/cloudfoundry/identity/uaa/authentication/SystemAuthenticationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* **************************************************************************** | ||
* Cloud Foundry | ||
* Copyright (c) [2009-2017] Pivotal Software, Inc. All Rights Reserved. | ||
* | ||
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this product except in compliance with the License. | ||
* | ||
* This product includes a number of subcomponents with | ||
* separate copyright notices and license terms. Your use of these | ||
* subcomponents is subject to the terms and conditions of the | ||
* subcomponent's license, as noted in the LICENSE file. | ||
* **************************************************************************** | ||
*/ | ||
|
||
package org.cloudfoundry.identity.uaa.authentication; | ||
|
||
import org.junit.Test; | ||
|
||
import static java.util.Collections.emptyList; | ||
import static org.cloudfoundry.identity.uaa.authentication.SystemAuthentication.PRINCIPAL; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNull; | ||
import static org.junit.Assert.assertSame; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
public class SystemAuthenticationTest { | ||
|
||
private SystemAuthentication auth = SystemAuthentication.SYSTEM_AUTHENTICATION; | ||
|
||
@Test | ||
public void getAuthorities() throws Exception { | ||
assertSame(emptyList(), auth.getAuthorities()); | ||
} | ||
|
||
@Test | ||
public void getCredentials() throws Exception { | ||
assertNull(auth.getCredentials()); | ||
} | ||
|
||
@Test | ||
public void getDetails() throws Exception { | ||
assertEquals(PRINCIPAL, auth.getDetails()); | ||
} | ||
|
||
@Test | ||
public void getPrincipal() throws Exception { | ||
assertEquals(PRINCIPAL, auth.getPrincipal()); | ||
} | ||
|
||
@Test | ||
public void isAuthenticated() throws Exception { | ||
assertTrue(auth.isAuthenticated()); | ||
} | ||
|
||
@Test | ||
public void setAuthenticated() throws Exception { | ||
auth.setAuthenticated(false); | ||
isAuthenticated(); | ||
} | ||
|
||
@Test | ||
public void getName() throws Exception { | ||
assertEquals(PRINCIPAL, auth.getName()); | ||
} | ||
|
||
} |
Oops, something went wrong.