Skip to content

Commit

Permalink
Prepare for 2.0 (#179)
Browse files Browse the repository at this point in the history
* IS-178 Code cleanup
* IS-178 Release notes
  • Loading branch information
martin-lindstrom authored Jan 14, 2025
1 parent c55c40b commit 49f2c61
Show file tree
Hide file tree
Showing 31 changed files with 673 additions and 214 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The Swedish eIDAS Connector is a [Spring Boot](https://spring.io/projects/spring

Go to <https://docs.swedenconnect.se/eidas-connector> for a set of resources for configuration, deployment and maintenance of the service.

Also, see the [Release Notes](https://docs.swedenconnect.se/eidas-connector/release-notes.html).

---

Copyright &copy; 2017-2025, [Myndigheten för digital förvaltning - Swedish Agency for Digital Government (DIGG)](http://www.digg.se). Licensed under version 2.0 of the [Apache License](http://www.apache.org/licenses/LICENSE-2.0).
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public List<UserAttribute> toSwedishUserAttributes(final Collection<UserAttribut
townOfBirth = Optional.ofNullable(this.toSwedishUserAttribute(eidasAttribute))
.map(UserAttribute::getStringValues)
.filter(v -> !v.isEmpty())
.map(v -> v.get(0))
.map(List::getFirst)
.orElse(null);
}
else {
Expand All @@ -267,7 +267,7 @@ else if (se.swedenconnect.opensaml.eidas.ext.attributes.AttributeConstants.EIDAS
countryOfBirth = Optional.ofNullable(this.toSwedishUserAttribute(eidasAttribute))
.map(UserAttribute::getStringValues)
.filter(v -> !v.isEmpty())
.map(v -> v.get(0))
.map(List::getFirst)
.orElse(null);
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected XMLObject toSwedishEidAttributeValue(final List<XMLObject> values) {
if (values.isEmpty()) {
return null;
}
if (!(values.get(0) instanceof final CurrentAddressType currentAddress)) {
if (!(values.getFirst() instanceof final CurrentAddressType currentAddress)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ protected XMLObject toSwedishEidAttributeValue(final List<XMLObject> values) {
.filter(TransliterationStringType.class::isInstance)
.filter(v -> ((TransliterationStringType) v).getLatinScript())
.findFirst()
.orElseGet(() -> values.get(0));
.orElseGet(values::getFirst);

final XMLObject eidasValue = values.size() == 1 ? values.get(0) : singleFunc.apply(values);
final XMLObject eidasValue = values.size() == 1 ? values.getFirst() : singleFunc.apply(values);
if (eidasValue instanceof EidasAttributeValueType) {
final String value = ((EidasAttributeValueType) eidasValue).toStringValue();
final XSString stringValue = AttributeBuilder.createValueObject(XSString.TYPE_NAME, XSString.class);
Expand All @@ -257,19 +257,19 @@ else if (eidasValue instanceof XSString) {
*/
protected String toSwedishEidAttributeValue(final UserAttribute eidasAttribute) {
final List<? extends Serializable> values = eidasAttribute.getValues();
if (values.get(0) instanceof TransliterationString) {
if (values.getFirst() instanceof TransliterationString) {
final XMLObject attributeValue = this.toSwedishEidAttributeValue(values.stream()
.map(TransliterationString.class::cast)
.map(TransliterationString::createXmlObject)
.map(XMLObject.class::cast)
.toList());
return ((XSString) attributeValue).getValue();
}
else if (values.get(0) instanceof EidasAttributeValue) {
return ((EidasAttributeValue<?>) values.get(0)).getValueAsString();
else if (values.getFirst() instanceof EidasAttributeValue) {
return ((EidasAttributeValue<?>) values.getFirst()).getValueAsString();
}
else {
return values.get(0).toString();
return values.getFirst().toString();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ protected XMLObject toSwedishEidAttributeValue(final List<XMLObject> values) {
if (values.isEmpty()) {
return null;
}
if (!(values.get(0) instanceof final GenderType genderValue)) {
if (!(values.getFirst() instanceof final GenderType genderValue)) {
return null;
}
String value;
final String value;
if (genderValue.getGender().equals(GenderTypeEnumeration.MALE)) {
value = "M";
}
Expand All @@ -114,7 +114,7 @@ protected String toSwedishEidAttributeValue(final UserAttribute eidasAttribute)
if (eidasAttribute.getValues().isEmpty()) {
return null;
}
final String gender = ((Gender) eidasAttribute.getValues().get(0)).getValueAsString();
final String gender = ((Gender) eidasAttribute.getValues().getFirst()).getValueAsString();
if (GenderTypeEnumeration.MALE.getValue().equalsIgnoreCase(gender)) {
return "M";
}
Expand Down
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The Swedish eIDAS Connector is an Open Source component, and is being used as an

The Swedish eIDAS Connector is a [Spring Boot](https://spring.io/projects/spring-boot) application built on top of the [Spring Security SAML Identity Provider](https://github.com/swedenconnect/saml-identity-provider) library. It acts as a SAML Identity Provider in the [Sweden Connect](https://www.swedenconnect.se) federation, and as a SAML Service Provider against the eIDAS federation.

- [Release Notes](https://docs.swedenconnect.se/eidas-connector/release-notes.html)

The following resources are available for information about configuration, deployment and maintenance of the service:

- [Building and Deploying the eIDAS Connector](https://docs.swedenconnect.se/eidas-connector/installation.html) - How to build and deploy the service.
Expand Down
Loading

0 comments on commit 49f2c61

Please sign in to comment.