[java-plugin-shibd-saml] branch main updated: Fix compiler errors not flagged by Eclipse.
Scott Cantor
cantor.2 at osu.edu
Tue Oct 15 17:03:43 UTC 2024
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-plugin-shibd-saml.
View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-shibd-saml.git;a=commit;h=6a02495a02f2185b6cf1ccdc061b726c87c1d8c4
The following commit(s) were added to refs/heads/main by this push:
new 6a02495 Fix compiler errors not flagged by Eclipse.
6a02495 is described below
commit 6a02495a02f2185b6cf1ccdc061b726c87c1d8c4
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Oct 15 13:03:41 2024 -0400
Fix compiler errors not flagged by Eclipse.
---
.../saml2/profile/impl/ExtractSAMLAttributes.java | 153 ++++++++++++---------
1 file changed, 90 insertions(+), 63 deletions(-)
diff --git a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ExtractSAMLAttributes.java b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ExtractSAMLAttributes.java
index 4f9e0b6..a527ab8 100644
--- a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ExtractSAMLAttributes.java
+++ b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ExtractSAMLAttributes.java
@@ -667,6 +667,7 @@ public class ExtractSAMLAttributes extends AbstractApplicationAction {
dnsNameAttributeId = StringSupport.trimOrNull(id);
}
+// Checkstyle: CyclomaticComplexity|MethodLength OFF
/** {@inheritDoc} */
@Nullable public Collection<IdPAttribute> apply(@Nullable final SAMLTokenContext samlTokenContext) {
final AuthnStatement statement = samlTokenContext != null ? samlTokenContext.getAuthnStatement() : null;
@@ -681,54 +682,67 @@ public class ExtractSAMLAttributes extends AbstractApplicationAction {
if (issuerAttributeId != null) {
final Issuer issuer = assertion.getIssuer();
- if (issuer != null) {
- if (issuer.getValue() instanceof String s) {
- assert issuerAttributeId != null;
- final IdPAttribute attr = new IdPAttribute(issuerAttributeId);
- attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
- attributes.add(attr);
- }
+ final String s = issuer != null ? issuer.getValue() : null;
+ if (s != null) {
+ assert issuerAttributeId != null;
+ final IdPAttribute attr = new IdPAttribute(issuerAttributeId);
+ attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
+ attributes.add(attr);
}
}
- if (authnInstantAttributeId != null && statement.getAuthnInstant() instanceof Instant ts) {
- assert authnInstantAttributeId != null;
- final IdPAttribute attr = new IdPAttribute(authnInstantAttributeId);
- attr.setValues(CollectionSupport.singletonList(new DateTimeAttributeValue(ts)));
- attributes.add(attr);
+ if (authnInstantAttributeId != null) {
+ final Instant ts = statement.getAuthnInstant();
+ if (ts != null) {
+ assert authnInstantAttributeId != null;
+ final IdPAttribute attr = new IdPAttribute(authnInstantAttributeId);
+ attr.setValues(CollectionSupport.singletonList(new DateTimeAttributeValue(ts)));
+ attributes.add(attr);
+ }
}
final AuthnContext ac = statement.getAuthnContext();
- final AuthnContextClassRef classRef = ac != null ? ac.getAuthnContextClassRef() : null;
- if (authnContextClassRefAttributeId != null && classRef != null && classRef.getURI() instanceof String s) {
- assert authnContextClassRefAttributeId != null;
- final IdPAttribute attr = new IdPAttribute(authnContextClassRefAttributeId);
- attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
- attributes.add(attr);
+ if (authnContextClassRefAttributeId != null && ac != null) {
+ final AuthnContextClassRef classRef = ac.getAuthnContextClassRef();
+ final String s = classRef != null ? classRef.getURI() : null;
+ if (s != null) {
+ assert authnContextClassRefAttributeId != null;
+ final IdPAttribute attr = new IdPAttribute(authnContextClassRefAttributeId);
+ attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
+ attributes.add(attr);
+ }
}
- final AuthnContextDeclRef declRef = ac != null ? ac.getAuthnContextDeclRef() : null;
- if (authnContextDeclRefAttributeId != null && declRef != null && declRef.getURI() instanceof String s) {
- assert authnContextDeclRefAttributeId != null;
- final IdPAttribute attr = new IdPAttribute(authnContextDeclRefAttributeId);
- attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
- attributes.add(attr);
+ if (authnContextDeclRefAttributeId != null && ac != null) {
+ final AuthnContextDeclRef declRef = ac.getAuthnContextDeclRef();
+ final String s = declRef != null ? declRef.getURI() : null;
+ if (s != null) {
+ assert authnContextDeclRefAttributeId != null;
+ final IdPAttribute attr = new IdPAttribute(authnContextDeclRefAttributeId);
+ attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
+ attributes.add(attr);
+ }
}
- if (sessionIndexAttributeId != null && statement.getSessionIndex() instanceof String s) {
- assert sessionIndexAttributeId != null;
- final IdPAttribute attr = new IdPAttribute(sessionIndexAttributeId);
- attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
- attributes.add(attr);
+ if (sessionIndexAttributeId != null) {
+ final String s = statement.getSessionIndex();
+ if (s != null) {
+ assert sessionIndexAttributeId != null;
+ final IdPAttribute attr = new IdPAttribute(sessionIndexAttributeId);
+ attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
+ attributes.add(attr);
+ }
}
- if (consentAttributeId != null && assertion.getParent() instanceof StatusResponseType srt
- && srt.getConsent() instanceof String consent) {
- assert consentAttributeId != null;
- final IdPAttribute attr = new IdPAttribute(consentAttributeId);
- attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(consent)));
- attributes.add(attr);
+ if (consentAttributeId != null && assertion.getParent() instanceof StatusResponseType srt) {
+ final String s = srt.getConsent();
+ if (s != null) {
+ assert consentAttributeId != null;
+ final IdPAttribute attr = new IdPAttribute(consentAttributeId);
+ attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
+ attributes.add(attr);
+ }
}
if (authorityAttributeId != null && ac != null && !ac.getAuthenticatingAuthorities().isEmpty()) {
@@ -745,48 +759,61 @@ public class ExtractSAMLAttributes extends AbstractApplicationAction {
final Conditions conditions = assertion.getConditions();
- if (notBeforeAttributeId != null && conditions != null
- && conditions.getNotBefore() instanceof Instant ts) {
- assert notBeforeAttributeId != null;
- final IdPAttribute attr = new IdPAttribute(notBeforeAttributeId);
- attr.setValues(CollectionSupport.singletonList(new DateTimeAttributeValue(ts)));
- attributes.add(attr);
+ if (notBeforeAttributeId != null && conditions != null) {
+ final Instant ts = conditions.getNotBefore();
+ if (ts != null) {
+ assert notBeforeAttributeId != null;
+ final IdPAttribute attr = new IdPAttribute(notBeforeAttributeId);
+ attr.setValues(CollectionSupport.singletonList(new DateTimeAttributeValue(ts)));
+ attributes.add(attr);
+ }
}
- if (notOnOrAfterAttributeId != null && conditions != null
- && conditions.getNotOnOrAfter() instanceof Instant ts) {
- assert notOnOrAfterAttributeId != null;
- final IdPAttribute attr = new IdPAttribute(notOnOrAfterAttributeId);
- attr.setValues(CollectionSupport.singletonList(new DateTimeAttributeValue(ts)));
- attributes.add(attr);
+ if (notOnOrAfterAttributeId != null && conditions != null) {
+ final Instant ts = conditions.getNotOnOrAfter();
+ if (ts != null) {
+ assert notOnOrAfterAttributeId != null;
+ final IdPAttribute attr = new IdPAttribute(notOnOrAfterAttributeId);
+ attr.setValues(CollectionSupport.singletonList(new DateTimeAttributeValue(ts)));
+ attributes.add(attr);
+ }
}
- if (sessionNotOnOrAfterAttributeId != null
- && statement.getSessionNotOnOrAfter() instanceof Instant ts) {
- assert sessionNotOnOrAfterAttributeId != null;
- final IdPAttribute attr = new IdPAttribute(sessionNotOnOrAfterAttributeId);
- attr.setValues(CollectionSupport.singletonList(new DateTimeAttributeValue(ts)));
- attributes.add(attr);
+ if (sessionNotOnOrAfterAttributeId != null) {
+ final Instant ts = statement.getSessionNotOnOrAfter();
+ if (ts != null) {
+ assert sessionNotOnOrAfterAttributeId != null;
+ final IdPAttribute attr = new IdPAttribute(sessionNotOnOrAfterAttributeId);
+ attr.setValues(CollectionSupport.singletonList(new DateTimeAttributeValue(ts)));
+ attributes.add(attr);
+ }
}
final SubjectLocality locality = statement.getSubjectLocality();
- if (addressAttributeId != null && locality != null && locality.getAddress() instanceof String s) {
- assert addressAttributeId != null;
- final IdPAttribute attr = new IdPAttribute(addressAttributeId);
- attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
- attributes.add(attr);
+ if (addressAttributeId != null && locality != null) {
+ final String s = locality.getAddress();
+ if (s != null) {
+ assert addressAttributeId != null;
+ final IdPAttribute attr = new IdPAttribute(addressAttributeId);
+ attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
+ attributes.add(attr);
+ }
}
- if (dnsNameAttributeId != null && locality != null && locality.getDNSName() instanceof String s) {
- assert dnsNameAttributeId != null;
- final IdPAttribute attr = new IdPAttribute(dnsNameAttributeId);
- attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
- attributes.add(attr);
+ if (dnsNameAttributeId != null && locality != null) {
+ final String s = locality.getDNSName();
+ if (s != null) {
+ assert dnsNameAttributeId != null;
+ final IdPAttribute attr = new IdPAttribute(dnsNameAttributeId);
+ attr.setValues(CollectionSupport.singletonList(new StringAttributeValue(s)));
+ attributes.add(attr);
+ }
}
return attributes;
}
+// Checkstyle: CyclomaticComplexity|MethodLength ON
}
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list