Skip to content

Commit

Permalink
Merge pull request swedenconnect#242 from swedenconnect/fixbranch-1.1.3
Browse files Browse the repository at this point in the history
Fixbranch 1.1.3
  • Loading branch information
martin-lindstrom authored Jan 23, 2024
2 parents c3a9d20 + de7a7c3 commit 1f15be1
Show file tree
Hide file tree
Showing 438 changed files with 2,383 additions and 2,092 deletions.
2 changes: 1 addition & 1 deletion bankid-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>se.swedenconnect.bankid</groupId>
<artifactId>saml-bankid-idp-parent</artifactId>
<version>1.1.2</version>
<version>1.1.3</version>
</parent>

<name>Sweden Connect :: BankID :: Relying Party API</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public final class LibraryVersion {

private static final int MAJOR = 1;
private static final int MINOR = 1;
private static final int PATCH = 2;
private static final int PATCH = 3;

/**
* Global serialization value for classes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
import org.springframework.web.reactive.function.BodyExtractors;
import org.springframework.web.reactive.function.client.ClientResponse;
import reactor.core.publisher.Mono;
import se.swedenconnect.bankid.rpapi.types.ErrorCode;

import java.util.HashMap;
import java.util.Objects;
import java.util.function.Function;
/**
* Body Extractors for BankIdErrors
Expand All @@ -36,6 +38,10 @@ public class BankIdErrorBodyExtractors {
public static Function<ClientResponse, Mono<? extends Throwable>> userErrorBodyExtractor() {
return c -> {
return c.body(BodyExtractors.toMono(HashMap.class)).map(m -> {
final String errorCode = (String) m.get("errorCode");
if (Objects.nonNull(errorCode)) {
return new BankIdUserException(ErrorCode.forValue(errorCode), "Error to communicate with BankID API response:" + m.toString());
}
return new BankIdUserException("Error to communicate with BankID API response:" + m.toString());
});
};
Expand All @@ -48,6 +54,10 @@ public static Function<ClientResponse, Mono<? extends Throwable>> userErrorBodyE
public static Function<ClientResponse, Mono<? extends Throwable>> serverErrorBodyExtractor() {
return c -> {
return c.body(BodyExtractors.toMono(HashMap.class)).map(m -> {
final String errorCode = (String) m.get("errorCode");
if (Objects.nonNull(errorCode)) {
return new BankIdUserException(ErrorCode.forValue(errorCode), "Error to communicate with BankID API response:" + m.toString());
}
return new BankIdServerException("Error to communicate with BankID API response:" + m.toString());
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import se.swedenconnect.bankid.rpapi.LibraryVersion;
import se.swedenconnect.bankid.rpapi.types.BankIDException;
import se.swedenconnect.bankid.rpapi.types.ErrorCode;

/**
* Exception class for 4XX API errors.
Expand All @@ -38,4 +39,7 @@ public BankIdUserException(final String message) {
super(message);
}

public BankIdUserException(ErrorCode errorCode, String message) {
super(errorCode, message);
}
}
3 changes: 2 additions & 1 deletion bankid-frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="assets/favicon.ico" />
<link rel="icon" href="%BASE_URL%/favicon.png" sizes="32x32" />
<link rel="icon" href="%BASE_URL%/favicon.svg" type="image/svg+xml" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BankID</title>
</head>
Expand Down
2 changes: 1 addition & 1 deletion bankid-frontend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>se.swedenconnect.bankid</groupId>
<artifactId>saml-bankid-idp-parent</artifactId>
<version>1.1.2</version>
<version>1.1.3</version>
</parent>

<name>Sweden Connect :: BankID :: SAML Identity Provider :: Frontend Distribution</name>
Expand Down
Binary file removed bankid-frontend/src/assets/favicon.ico
Binary file not shown.
5 changes: 3 additions & 2 deletions bankid-idp/env/local/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ bankid:
ui:
provider:
svg-logotype: file:${BANKID_INSTALL_DIR}/bankid-idp/env/local/icon/icon.svg
svg-favicon: file:${BANKID_INSTALL_DIR}/bankid-idp/env/local/icon/favicon.svg
png-favicon: file:${BANKID_INSTALL_DIR}/bankid-idp/env/local/icon/favicon.png
name:
sv: "Sweden Connect"
en: "Sweden Connect"
Expand Down Expand Up @@ -186,5 +188,4 @@ spring:
- from: "172.20.0.32:2002"
to: "redis2.local.dev.swedenconnect.se:2002"
- from: "172.20.0.33:2003"
to: "redis3.local.dev.swedenconnect.se:2003"

to: "redis3.local.dev.swedenconnect.se:2003"
Binary file added bankid-idp/env/local/icon/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions bankid-idp/env/local/icon/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 1 addition & 6 deletions bankid-idp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>se.swedenconnect.bankid</groupId>
<artifactId>saml-bankid-idp-parent</artifactId>
<version>1.1.2</version>
<version>1.1.3</version>
</parent>

<name>Sweden Connect :: BankID :: SAML Identity Provider</name>
Expand Down Expand Up @@ -259,14 +259,9 @@
<container>
<creationTime>USE_CURRENT_TIMESTAMP</creationTime>
<jvmFlags>
<jvmFlag>-Dtomcat.ajp.enabled=true</jvmFlag>
<jvmFlag>-Djava.net.preferIPv4Stack=true</jvmFlag>
<jvmFlag>-Dorg.apache.xml.security.ignoreLineBreaks=true</jvmFlag>
</jvmFlags>
<ports>
<port>8012</port>
<port>8082</port>
</ports>
</container>
</configuration>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public final class ApplicationVersion {

private static final int MAJOR = 1;
private static final int MINOR = 1;
private static final int PATCH = 2;
private static final int PATCH = 3;

/**
* Global serialization value for classes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,14 @@ private static ApiResponse.Status statusOf(final BankIdSessionData sessionData)
public static ApiResponse createUserCancelResponse() {
return new ApiResponse(ApiResponse.Status.CANCEL, "", "", "bankid.msg.error.userCancel");
}

/**
* Creates an {@link ApiResponse} representing an unknown error.
* This does not necessarily mean that the error is unknown but should not be presented to the user.
*
* @return an {@link ApiResponse}
*/
public static ApiResponse createUnknownError() {
return new ApiResponse(ApiResponse.Status.ERROR, "", "", "bankid.msg.error.unknown");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
import se.swedenconnect.bankid.rpapi.service.BankIDClient;
import se.swedenconnect.bankid.rpapi.service.UserVisibleData;
import se.swedenconnect.bankid.rpapi.service.impl.BankIdServerException;
import se.swedenconnect.bankid.rpapi.service.impl.BankIdUserException;
import se.swedenconnect.bankid.rpapi.types.BankIDException;
import se.swedenconnect.bankid.rpapi.types.ErrorCode;
import se.swedenconnect.bankid.rpapi.types.ProgressStatus;
import se.swedenconnect.opensaml.sweid.saml2.attribute.AttributeConstants;
import se.swedenconnect.opensaml.sweid.saml2.metadata.entitycategory.EntityCategoryConstants;
Expand Down Expand Up @@ -143,8 +145,8 @@ public Mono<ApiResponse> poll(final HttpServletRequest request,
return this.service.poll(pollRequest)
.onErrorResume(e -> e instanceof BankIdServerException,
e -> Mono.just(ApiResponseFactory.createErrorResponseBankIdServerException()))
.onErrorResume(e -> e instanceof BankIDException,
e -> Mono.just(ApiResponseFactory.createErrorResponseTimeExpired()));
.onErrorResume(e -> e instanceof BankIdUserException && ((BankIdUserException) e).getErrorCode() == ErrorCode.INVALID_PARAMETERS, e -> Mono.just(ApiResponseFactory.createUnknownError()))
.onErrorResume(e -> e instanceof BankIDException, e -> Mono.just(ApiResponseFactory.createErrorResponseTimeExpired()));
}
}

Expand All @@ -170,6 +172,30 @@ public byte[] getProviderLogotype() throws IOException {
return this.uiInformation.getProviderLogo();
}

/**
* Gets the provider SVG favicon to be displayed.
*
* @return SVG image as bytes
* @throws IOException see {@link IOUtils} method toByteArray(InputStream inputStream)
*/
@GetMapping(value = "/favicon.svg", produces = "image/svg+xml")
@ResponseBody
public byte[] getProviderSvgFavicon() throws IOException {
return this.uiInformation.getProviderSvgFavicon();
}

/**
* Gets the provider PNG favicon to be displayed.
*
* @return PNG image as bytes
* @throws IOException see {@link IOUtils} method toByteArray(InputStream inputStream)
*/
@GetMapping(value = "/favicon.png", produces = "image/png")
@ResponseBody
public byte[] getProviderPngFavicon() throws IOException {
return this.uiInformation.getProviderPngFavicon();
}

/**
* Lazy load of message, if no message is set, it is calculated and published to be persisted.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,38 @@ public byte[] getProviderLogo() throws IOException {
return IOUtils.toByteArray(logoResource.getInputStream());
}

/**
* Gets the provider favicon in SVG format.
*
* @return an SVG favicon as byte array
* @throws IOException see {@link IOUtils} method toByteArray(InputStream inputStream)
*/
public byte[] getProviderSvgFavicon() throws IOException {

Resource logoResource = Optional.ofNullable(this.uiProperties.getProvider())
.map(UiProperties.ApplicationProviderProperties::getSvgFavicon)
// Otherwise. Deliver an BankID SVG Favicon ...
.orElseGet(() -> new ClassPathResource("static/images/favicon.svg"));

return IOUtils.toByteArray(logoResource.getInputStream());
}

/**
* Gets the provider favicon in PNG format.
*
* @return an PNG favicon as byte array
* @throws IOException see {@link IOUtils} method toByteArray(InputStream inputStream)
*/
public byte[] getProviderPngFavicon() throws IOException {

Resource logoResource = Optional.ofNullable(this.uiProperties.getProvider())
.map(UiProperties.ApplicationProviderProperties::getPngFavicon)
// Otherwise. Deliver an BankID PNG Favicon ...
.orElseGet(() -> new ClassPathResource("static/images/favicon.png"));

return IOUtils.toByteArray(logoResource.getInputStream());
}

/**
* Obtains the information for the current SP information.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ SecurityFilterChain defaultSecurityFilterChain(final HttpSecurity http) throws E
})
.authorizeHttpRequests((authorize) -> authorize
.requestMatchers(this.properties.getAuthn().getAuthnPath() + "/**").permitAll()
.requestMatchers("/images/**", "/logo.svg", "/error", "/assets/**", "/scripts/**", "/webjars/**", "/view/**",
.requestMatchers("/images/**", "/logo.svg", "/favicon.svg", "/favicon.png", "/error", "/assets/**", "/scripts/**", "/webjars/**", "/view/**",
"/css/**", "/api/**", "/resume/**")
.permitAll()
.requestMatchers(EndpointRequest.toAnyEndpoint())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,23 @@ public static class ApplicationProviderProperties {
@Setter
private Resource svgLogotype;

/**
* The favicon to be displayed in the browser tab, etc. This favicon must be in SVG format. SVG favicons are
* supported in Firefox and Chromium-based browsers. If no favicon is assigned, the BankID logo will be used.
*/
@Getter
@Setter
private Resource svgFavicon;

/**
* The favicon to be displayed in the browser tab, etc. This favicon must be in PNG format and should be 32 x 32
* pixels in dimension. PNG favicons are supported by all modern browsers, including Internet Explorer 11. If no
* favicon is assigned, the BankID logo will be used.
*/
@Getter
@Setter
private Resource pngFavicon;

/**
* The name for the provider as a map where the keys are language codes and the values the name in respective
* language. This name will primarily be used at the bottom of the page in the copyright statement, but may later by
Expand Down
2 changes: 1 addition & 1 deletion bankid-idp/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ saml:
logotypes:
- path: /images/BankID_logo.svg
height: 171
width: 20
width: 206
# organization:
# names:
# en: "My Organization"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions bankid-idp/src/main/resources/static/images/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions docs/apidocs/allclasses-index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Dec 12 15:09:09 CET 2023 -->
<title>All Classes and Interfaces (BankID SAML IdP - 1.1.2)</title>
<!-- Generated by javadoc (17) on Tue Jan 23 11:23:53 CET 2024 -->
<title>All Classes and Interfaces (BankID SAML IdP - 1.1.3)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2023-12-12">
<meta name="dc.created" content="2024-01-23">
<meta name="description" content="class index">
<meta name="generator" content="javadoc/AllClassesIndexWriter">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="script-dir/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="script-dir/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="script-dir/jquery-ui.min.js"></script>
</head>
<body class="all-classes-index-page">
Expand Down Expand Up @@ -733,7 +733,7 @@ <h1 title="All Classes and Interfaces" class="title">All Classes and Interfaces<
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2023 <a href="https://www.swedenconnect.se">Sweden Connect</a>. All rights reserved.</small></p>
<p class="legal-copy"><small>Copyright &#169; 2024 <a href="https://www.swedenconnect.se">Sweden Connect</a>. All rights reserved.</small></p>
</footer>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions docs/apidocs/allpackages-index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Dec 12 15:09:09 CET 2023 -->
<title>All Packages (BankID SAML IdP - 1.1.2)</title>
<!-- Generated by javadoc (17) on Tue Jan 23 11:23:53 CET 2024 -->
<title>All Packages (BankID SAML IdP - 1.1.3)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2023-12-12">
<meta name="dc.created" content="2024-01-23">
<meta name="description" content="package index">
<meta name="generator" content="javadoc/AllPackagesIndexWriter">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="script-dir/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="script-dir/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="script-dir/jquery-ui.min.js"></script>
</head>
<body class="all-packages-index-page">
Expand Down Expand Up @@ -155,7 +155,7 @@ <h1 title="All&amp;nbsp;Packages" class="title">All&nbsp;Packages</h1>
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2023 <a href="https://www.swedenconnect.se">Sweden Connect</a>. All rights reserved.</small></p>
<p class="legal-copy"><small>Copyright &#169; 2024 <a href="https://www.swedenconnect.se">Sweden Connect</a>. All rights reserved.</small></p>
</footer>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions docs/apidocs/constant-values.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Dec 12 15:09:09 CET 2023 -->
<title>Constant Field Values (BankID SAML IdP - 1.1.2)</title>
<!-- Generated by javadoc (17) on Tue Jan 23 11:23:53 CET 2024 -->
<title>Constant Field Values (BankID SAML IdP - 1.1.3)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2023-12-12">
<meta name="dc.created" content="2024-01-23">
<meta name="description" content="summary of constants">
<meta name="generator" content="javadoc/ConstantsSummaryWriterImpl">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="script-dir/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="script-dir/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="script-dir/jquery-ui.min.js"></script>
</head>
<body class="constants-summary-page">
Expand Down Expand Up @@ -236,7 +236,7 @@ <h2 title="se.swedenconnect">se.swedenconnect.*</h2>
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2023 <a href="https://www.swedenconnect.se">Sweden Connect</a>. All rights reserved.</small></p>
<p class="legal-copy"><small>Copyright &#169; 2024 <a href="https://www.swedenconnect.se">Sweden Connect</a>. All rights reserved.</small></p>
</footer>
</div>
</div>
Expand Down
Loading

0 comments on commit 1f15be1

Please sign in to comment.