-
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.
Adding support for mapping groups to roles. Also includes some code c…
…leanup.
- Loading branch information
1 parent
32e61bb
commit e29adc7
Showing
7 changed files
with
65 additions
and
14 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
7 changes: 7 additions & 0 deletions
7
src/main/java/gov/cdc/izgateway/security/principal/GroupToRoleMapper.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,7 @@ | ||
package gov.cdc.izgateway.security.principal; | ||
|
||
import java.util.Set; | ||
|
||
public interface GroupToRoleMapper { | ||
Set<String> mapGroupsToRoles(Set<String> groups); | ||
} |
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
7 changes: 7 additions & 0 deletions
7
src/main/java/gov/cdc/izgateway/security/principal/ScopeToRoleMapper.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,7 @@ | ||
package gov.cdc.izgateway.security.principal; | ||
|
||
import java.util.Set; | ||
|
||
public interface ScopeToRoleMapper { | ||
Set<String> mapScopesToRoles(Set<String> scopes); | ||
} |
8 changes: 5 additions & 3 deletions
8
...ateway/security/principal/RoleMapper.java → ...rity/principal/ScopeToRoleMapperImpl.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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
package gov.cdc.izgateway.security.principal; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Set; | ||
import java.util.TreeSet; | ||
|
||
public class RoleMapper { | ||
public static Set<String> mapScopesToRoles(Set<String> scopes) { | ||
@Component | ||
public class ScopeToRoleMapperImpl implements ScopeToRoleMapper { | ||
public Set<String> mapScopesToRoles(Set<String> scopes) { | ||
// Until we've defined a mapping between scopes and roles, we'll just return the scopes as roles | ||
return new TreeSet<>(scopes); | ||
} | ||
|
||
} |