forked from apereo/cas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reorg components to fix circular dependencies
- Loading branch information
Showing
13 changed files
with
41 additions
and
36 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ public class DefaultAttributeDefinitionStoreTests { | |
|
||
@Test | ||
public void verifyAttrDefnNotFound() { | ||
val service = CoreAuthenticationTestUtils.getRegisteredService(); | ||
val store = new DefaultAttributeDefinitionStore(); | ||
store.setScope("example.org"); | ||
val defn = DefaultAttributeDefinition.builder() | ||
|
@@ -41,12 +42,13 @@ public void verifyAttrDefnNotFound() { | |
.build(); | ||
store.registerAttributeDefinition(defn); | ||
var values = (Optional<Pair<AttributeDefinition, List<Object>>>) store.resolveAttributeValues("whatever", | ||
CollectionUtils.wrap(CoreAuthenticationTestUtils.CONST_USERNAME)); | ||
CollectionUtils.wrap(CoreAuthenticationTestUtils.CONST_USERNAME), service); | ||
assertTrue(values.isEmpty()); | ||
} | ||
|
||
@Test | ||
public void verifyAttributeDefinitionsAsMap() { | ||
val service = CoreAuthenticationTestUtils.getRegisteredService(); | ||
val store = new DefaultAttributeDefinitionStore(); | ||
store.setScope("example.org"); | ||
val defn = DefaultAttributeDefinition.builder() | ||
|
@@ -56,7 +58,7 @@ public void verifyAttributeDefinitionsAsMap() { | |
.build(); | ||
store.registerAttributeDefinition(defn); | ||
assertFalse(store.isEmpty()); | ||
val attrs = store.resolveAttributeValues(CoreAuthenticationTestUtils.getAttributes()); | ||
val attrs = store.resolveAttributeValues(CoreAuthenticationTestUtils.getAttributes(), service); | ||
assertFalse(attrs.isEmpty()); | ||
assertTrue(attrs.containsKey("mail")); | ||
assertTrue(attrs.containsKey(defn.getName())); | ||
|
@@ -66,6 +68,7 @@ public void verifyAttributeDefinitionsAsMap() { | |
|
||
@Test | ||
public void verifyScopedAttrDefn() { | ||
val service = CoreAuthenticationTestUtils.getRegisteredService(); | ||
val store = new DefaultAttributeDefinitionStore(); | ||
store.setScope("example.org"); | ||
val defn = DefaultAttributeDefinition.builder() | ||
|
@@ -74,13 +77,15 @@ public void verifyScopedAttrDefn() { | |
.scoped(true) | ||
.build(); | ||
store.registerAttributeDefinition(defn); | ||
var values = store.resolveAttributeValues("eduPersonPrincipalName", CollectionUtils.wrap(CoreAuthenticationTestUtils.CONST_USERNAME)); | ||
var values = store.resolveAttributeValues("eduPersonPrincipalName", | ||
CollectionUtils.wrap(CoreAuthenticationTestUtils.CONST_USERNAME), service); | ||
assertTrue(values.isPresent()); | ||
assertTrue(values.get().getValue().contains("[email protected]")); | ||
} | ||
|
||
@Test | ||
public void verifyScriptedEmbeddedAttrDefn() { | ||
val service = CoreAuthenticationTestUtils.getRegisteredService(); | ||
val store = new DefaultAttributeDefinitionStore(); | ||
store.setScope("example.org"); | ||
val defn = DefaultAttributeDefinition.builder() | ||
|
@@ -91,14 +96,15 @@ public void verifyScriptedEmbeddedAttrDefn() { | |
.build(); | ||
store.registerAttributeDefinition(defn); | ||
var values = store.resolveAttributeValues("eduPersonPrincipalName", | ||
CollectionUtils.wrap(CoreAuthenticationTestUtils.CONST_USERNAME)); | ||
CollectionUtils.wrap(CoreAuthenticationTestUtils.CONST_USERNAME), service); | ||
assertTrue(values.isPresent()); | ||
assertTrue(values.get().getValue().contains("[email protected]")); | ||
assertTrue(values.get().getValue().contains("[email protected]")); | ||
} | ||
|
||
@Test | ||
public void verifyScriptedExternalAttrDefn() { | ||
val service = CoreAuthenticationTestUtils.getRegisteredService(); | ||
val store = new DefaultAttributeDefinitionStore(); | ||
store.setScope("system.org"); | ||
val defn = DefaultAttributeDefinition.builder() | ||
|
@@ -109,14 +115,15 @@ public void verifyScriptedExternalAttrDefn() { | |
.build(); | ||
store.registerAttributeDefinition(defn); | ||
var values = store.resolveAttributeValues("eduPersonPrincipalName", | ||
CollectionUtils.wrap(CoreAuthenticationTestUtils.CONST_USERNAME)); | ||
CollectionUtils.wrap(CoreAuthenticationTestUtils.CONST_USERNAME), service); | ||
assertTrue(values.isPresent()); | ||
assertTrue(values.get().getValue().contains("[email protected]")); | ||
assertTrue(values.get().getValue().contains("[email protected]")); | ||
} | ||
|
||
@Test | ||
public void verifyFormattedAttrDefn() { | ||
val service = CoreAuthenticationTestUtils.getRegisteredService(); | ||
val store = new DefaultAttributeDefinitionStore(); | ||
store.setScope("example.org"); | ||
val defn = DefaultAttributeDefinition.builder() | ||
|
@@ -127,7 +134,7 @@ public void verifyFormattedAttrDefn() { | |
.build(); | ||
store.registerAttributeDefinition(defn); | ||
var values = store.resolveAttributeValues("eduPersonPrincipalName", | ||
CollectionUtils.wrap(CoreAuthenticationTestUtils.CONST_USERNAME)); | ||
CollectionUtils.wrap(CoreAuthenticationTestUtils.CONST_USERNAME), service); | ||
assertTrue(values.isPresent()); | ||
assertTrue(values.get().getValue().contains("hello,[email protected]")); | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
import org.apereo.cas.authentication.AttributeMergingStrategy; | ||
import org.apereo.cas.authentication.CoreAuthenticationTestUtils; | ||
import org.apereo.cas.authentication.principal.Principal; | ||
import org.apereo.cas.services.RegisteredServicePrincipalAttributesRepository; | ||
import org.apereo.cas.authentication.principal.PrincipalFactory; | ||
import org.apereo.cas.authentication.principal.PrincipalFactoryUtils; | ||
|
||
|
@@ -29,7 +28,8 @@ | |
import static org.mockito.Mockito.*; | ||
|
||
/** | ||
* Parent class for test cases around {@link RegisteredServicePrincipalAttributesRepository}. | ||
* Parent class for test cases around | ||
* {@link org.apereo.cas.authentication.principal.RegisteredServicePrincipalAttributesRepository}. | ||
* | ||
* @author Misagh Moayyed | ||
* @since 4.2 | ||
|
@@ -71,8 +71,6 @@ public void initialize() { | |
this.principal = this.principalFactory.createPrincipal("uid", Collections.singletonMap(MAIL, email)); | ||
} | ||
|
||
protected abstract AbstractPrincipalAttributesRepository getPrincipalAttributesRepository(String unit, long duration); | ||
|
||
@Test | ||
@SneakyThrows | ||
public void checkExpiredCachedAttributes() { | ||
|
@@ -142,4 +140,6 @@ public void verifyMergingStrategyWithMultivaluedAttributeMerger() { | |
assertTrue(mailAttr.contains("[email protected]")); | ||
} | ||
} | ||
|
||
protected abstract AbstractPrincipalAttributesRepository getPrincipalAttributesRepository(String unit, long duration); | ||
} |
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