Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to read 'storeCustomAttributes' configuration file for id…
…entity providers from the UAA configuration file [#144964151] https://www.pivotaltracker.com/story/show/144964151
- Loading branch information
Showing
10 changed files
with
113 additions
and
3 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
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
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
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
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
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
...udfoundry/identity/uaa/provider/oauth/OauthIdentityProviderDefinitionFactoryBeanTest.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 | Original file line | 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.provider.oauth; | |||
|
|||
import org.cloudfoundry.identity.uaa.provider.OIDCIdentityProviderDefinition; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
|
|||
import java.util.HashMap; | |||
|
|||
import static org.cloudfoundry.identity.uaa.provider.ExternalIdentityProviderDefinition.STORE_CUSTOM_ATTRIBUTES_NAME; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
|
|||
public class OauthIdentityProviderDefinitionFactoryBeanTest { | |||
|
|||
private OauthIdentityProviderDefinitionFactoryBean factoryBean; | |||
private HashMap<String, Object> idpDefinitionMap; | |||
private OIDCIdentityProviderDefinition providerDefinition; | |||
|
|||
@Before | |||
public void setup() throws Exception { | |||
factoryBean = new OauthIdentityProviderDefinitionFactoryBean(null); | |||
providerDefinition = new OIDCIdentityProviderDefinition(); | |||
idpDefinitionMap = new HashMap<>(); | |||
idpDefinitionMap.put("authUrl", "http://auth.url"); | |||
idpDefinitionMap.put("relyingPartyId", "theClientId"); | |||
idpDefinitionMap.put("relyingPartySecret", "theClientSecret"); | |||
idpDefinitionMap.put("tokenKey", "key"); | |||
idpDefinitionMap.put("tokenUrl", "http://token.url"); | |||
idpDefinitionMap.put("tokenKeyUrl", "http://token-key.url"); | |||
} | |||
|
|||
@Test | |||
public void store_custom_attributes_default() throws Exception { | |||
factoryBean.setCommonProperties(idpDefinitionMap, providerDefinition); | |||
assertFalse(providerDefinition.isStoreCustomAttributes()); | |||
} | |||
|
|||
@Test | |||
public void store_custom_attributes_set_to_true() throws Exception { | |||
idpDefinitionMap.put(STORE_CUSTOM_ATTRIBUTES_NAME, true); | |||
factoryBean.setCommonProperties(idpDefinitionMap, providerDefinition); | |||
assertTrue(providerDefinition.isStoreCustomAttributes()); | |||
} | |||
|
|||
@Test | |||
public void store_custom_attributes_set_to_false() throws Exception { | |||
idpDefinitionMap.put(STORE_CUSTOM_ATTRIBUTES_NAME, false); | |||
factoryBean.setCommonProperties(idpDefinitionMap, providerDefinition); | |||
assertFalse(providerDefinition.isStoreCustomAttributes()); | |||
} | |||
|
|||
} |
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
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
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