You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2020/03/31 01:38:06 UTC
[cxf-fediz] 04/05: fediz-core: cleanup deprecated code in
SAMLTokenValidator
This is an automated email from the ASF dual-hosted git repository.
buhhunyx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git
commit b56e099f9d29329ead0196a25ed0eef9f9b23624
Author: Alexey Markevich <bu...@gmail.com>
AuthorDate: Tue Mar 24 11:16:07 2020 +0300
fediz-core: cleanup deprecated code in SAMLTokenValidator
---
.../cxf/fediz/core/saml/SAMLTokenValidator.java | 38 ++--------------------
1 file changed, 2 insertions(+), 36 deletions(-)
diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java
index 2165115..7e8f5ac 100644
--- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java
+++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java
@@ -192,8 +192,7 @@ public class SAMLTokenValidator implements TokenValidator {
if (assertion.getSamlVersion().equals(SAMLVersion.VERSION_20)) {
claims = parseClaimsInAssertion(assertion.getSaml2());
audience = getAudienceRestriction(assertion.getSaml2());
- } else if (assertion.getSamlVersion()
- .equals(SAMLVersion.VERSION_11)) {
+ } else if (assertion.getSamlVersion().equals(SAMLVersion.VERSION_11)) {
claims = parseClaimsInAssertion(assertion.getSaml1());
audience = getAudienceRestriction(assertion.getSaml1());
} else {
@@ -218,47 +217,14 @@ public class SAMLTokenValidator implements TokenValidator {
}
}
- @Deprecated
- protected List<String> parseRoles(FedizContext config, List<Claim> claims) {
- List<String> roles = null;
- Protocol protocol = config.getProtocol();
- if (protocol.getRoleURI() != null) {
- URI roleURI = URI.create(protocol.getRoleURI());
- String delim = protocol.getRoleDelimiter();
- for (Claim c : claims) {
- if (roleURI.equals(c.getClaimType())) {
- Object oValue = c.getValue();
- if ((oValue instanceof String) && !"".equals(oValue)) {
- if (delim == null) {
- roles = Collections.singletonList((String)oValue);
- } else {
- roles = parseRoles((String)oValue, delim);
- }
- } else if ((oValue instanceof List<?>) && !((List<?>)oValue).isEmpty()) {
- @SuppressWarnings("unchecked")
- List<String> values = (List<String>)oValue;
- roles = Collections.unmodifiableList(values);
- } else if (!((oValue instanceof String) || (oValue instanceof List<?>))) {
- LOG.error("Unsupported value type of Claim value");
- throw new IllegalStateException("Unsupported value type of Claim value");
- }
- claims.remove(c);
- break;
- }
- }
- }
-
- return roles;
- }
-
protected List<Claim> parseRoleClaim(FedizContext config, List<Claim> claims) {
- List<String> roles = null;
Protocol protocol = config.getProtocol();
if (protocol.getRoleURI() != null) {
URI roleURI = URI.create(protocol.getRoleURI());
String delim = protocol.getRoleDelimiter();
for (Claim c : claims) {
if (roleURI.equals(c.getClaimType())) {
+ final List<String> roles;
Object oValue = c.getValue();
if (oValue instanceof String) {
if (delim == null || "".equals(oValue)) {