Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xrddev 1711 - Central server backend part of the initialization functionality #1034

Merged
merged 61 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
9b63f89
XRDDEV-1711 Test case for context initializing
teemukin65 Aug 6, 2021
48f4a5e
XRDDEV-1711 Test case for System version controller
teemukin65 Aug 6, 2021
b06f19a
XRDDEV-1711 Situation update
teemukin65 Aug 11, 2021
4160508
XRDDEV-1711 MIT licenses added
teemukin65 Aug 11, 2021
9a36614
XRDDEV-1711 swagger-cli bundler needs direct refs
teemukin65 Aug 11, 2021
007c1d4
XRDDEV-1711 import statement ordering...
teemukin65 Aug 11, 2021
1c09258
XRDDEV-1711 outdated instruction
teemukin65 Aug 11, 2021
09746b5
XRDDEV-1711 one MIT license check more
teemukin65 Aug 11, 2021
b2c915f
XRDDEV-1711: Merge database module to admin-service
jhyoty Aug 12, 2021
6964bb5
XRDDEV-1711 Java version defined with java/toolchain/languageVersion …
teemukin65 Aug 12, 2021
fc23538
XRDDEV-1711 database component moved under entity - package.
teemukin65 Aug 12, 2021
ac417d1
XRDDEV-1711 SystemAPI/version - tests and ApplicationTests fixed
teemukin65 Aug 12, 2021
927adf9
XRDDEV-1711 InitializationController skeleton & tests fixed
teemukin65 Aug 12, 2021
882c1fc
XRDDEV-1711 InitializationController skeleton & tests warnings fixed
teemukin65 Aug 12, 2021
3bf97b7
XRDDEV-1711 InitializationService drafted.Init steps in cmts.
teemukin65 Aug 18, 2021
728abf2
XRDDEV-1711 Validators for init controller w/ tests added.
teemukin65 Aug 24, 2021
2878858
XRDDEV-1711 Failing InitializationApiControllerTest test cases added …
teemukin65 Aug 24, 2021
d0b43bd
XRDDEV-1711 getInitializationStatus/SW token status query implemented…
teemukin65 Aug 25, 2021
7c0dc42
XRDDEV-1711 getInitializationStatus/SW token status query improved tests
teemukin65 Aug 25, 2021
607846e
XRDDEV-1711 tests with Repository needed inline Mocking
teemukin65 Aug 26, 2021
b9290af
XRDDEV-1711 CentralServerSystemParameterService added with tests and …
teemukin65 Aug 26, 2021
c229d6c
XRDDEV-1711 Other SystemParameters initialized, HA-aware test drafted…
teemukin65 Aug 27, 2021
863f78e
XRDDEV-1711 GlobalGroupRepository access. Service Exceptions to own f…
teemukin65 Aug 30, 2021
6b2a294
Merge remote-tracking branch 'origin/develop-7.x' into XRDDEV-1711
teemukin65 Aug 30, 2021
9e89ffd
XRDDEV-1711 Missing license files...
teemukin65 Aug 30, 2021
c839db8
XRDDEV-1711 Test case & inspection fix
teemukin65 Aug 30, 2021
b4141f1
XRDDEV-1711 Improved debug & trace level logging
teemukin65 Aug 31, 2021
2b970a3
XRDDEV-1711 Make tests more transactional
teemukin65 Aug 31, 2021
1ea4083
XRDDEV-1711 Token pin code validator added.
teemukin65 Sep 1, 2021
eb2ebda
XRDDEV-1711 Token pin code validator error response test
teemukin65 Sep 2, 2021
13962df
XRDDEV-1711 invalid_init_params error values and validation errors de…
teemukin65 Sep 2, 2021
9e9e054
XRDDEV-1711 init params business -level check in service & invalid_in…
teemukin65 Sep 3, 2021
35ab7a2
XRDDEV-1711 developed test cases further
teemukin65 Sep 3, 2021
8624fbb
XRDDEV-1711 DeviationCodes for central server init added.
teemukin65 Sep 3, 2021
91426f7
XRDDEV-1711: Clean up tests
jhyoty Sep 3, 2021
a8ad1ce
XRDDEV-1711 RestTemplateTest dirtied context, now officially
teemukin65 Sep 3, 2021
d1084ec
XRDDEV-1711 same testSWToken can be used for InitializationApiControl…
teemukin65 Sep 3, 2021
b405460
XRDDEV-1711 Updated vulnerable gradle dependencies
teemukin65 Sep 3, 2021
97aeace
XRDDEV-1711 Ignore vulnerabilities in share-ui devDependencies
teemukin65 Sep 3, 2021
c404b2f
XRDDEV-1711 Prepare for SignerNotReachableException also for initiali…
teemukin65 Sep 7, 2021
84f7f4f
XRDDEV-1711 wrong SystemParameter sequence name
teemukin65 Sep 7, 2021
77265a2
XRDDEV-1711 SignerProxyFacade.java promoted to SignerProxyService and…
teemukin65 Sep 8, 2021
88455df
XRDDEV-1711 review cmt: HAConfigStatus can be @Value, test updated ac…
teemukin65 Sep 8, 2021
124b010
XRDDEV-1711 review cmt:simplified repository method names.
teemukin65 Sep 8, 2021
9b6829b
XRDDEV-1711 review cmt:CentralServerSystemParameterService -> SystemP…
teemukin65 Sep 8, 2021
9a8f42c
XRDDEV-1711 review cmt: SystemParameterService javadoc cmt
teemukin65 Sep 8, 2021
7e62b4a
XRDDEV-1711 review cmt: getInitializationStatusDto -> getInitializati…
teemukin65 Sep 8, 2021
5857673
XRDDEV-1711 improved context separation for InitializationApiControll…
teemukin65 Sep 8, 2021
afd0ec6
XRDDEV-1711 less magic strings, static final strings instead
teemukin65 Sep 8, 2021
de0e06c
XRDDEV-1711 make restTemplate based-test contexts dirty before each test
teemukin65 Sep 9, 2021
4c587ce
XRDDEV-1711 enable initialization of halfway-initialized central server
teemukin65 Sep 9, 2021
948c531
XRDDEV-1711 Can initialize from Init view, no success handler yet.
teemukin65 Sep 9, 2021
4ef4a1b
XRDDEV-1711 audit logging for central server initialization added
teemukin65 Sep 14, 2021
bcc988b
XRDDEV-1711 HA config detected only from config property
teemukin65 Sep 15, 2021
2e7265c
XRDDEV-1711 no <p> in JavaDoc
teemukin65 Sep 17, 2021
79b76d0
XRDDEV-1711 no Stream, but String.join!
teemukin65 Sep 17, 2021
c0772c7
XRDDEV-1711 isSWTokenInitialized simplification
teemukin65 Sep 17, 2021
19ebb51
XRDDEV-1711 SystemParameterService refactored per review cmts.
teemukin65 Sep 17, 2021
a6d85db
XRDDEV-1711 correct signerProxy method mocked in tests, improved exce…
teemukin65 Sep 20, 2021
c8eef32
Merge remote-tracking branch 'origin/develop-7.x' into XRDDEV-1711
jhyoty Sep 21, 2021
e4e5d90
XRDDEV-1711: Fix npm audit issues
jhyoty Sep 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file not shown.
6 changes: 5 additions & 1 deletion src/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ configure(subprojects.findAll { !["frontend","shared-ui","admin-ui"].contains(it
apply plugin: 'checkstyle'
apply plugin: 'jacoco'

sourceCompatibility = 1.8
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
Expand Down
25 changes: 12 additions & 13 deletions src/centralserver/admin-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import nl.javadude.gradle.plugins.license.License

plugins {
id 'io.spring.dependency-management'
id 'org.springframework.boot'
Expand All @@ -8,9 +10,6 @@ apply plugin: 'com.github.hierynomus.license'

archivesBaseName ='centralserver-admin-service'

sourceCompatibility = 11
targetCompatibility = 11

configurations {
dist {
canBeConsumed = false
Expand Down Expand Up @@ -47,13 +46,14 @@ openApiGenerate {
modelDocs: "false",
apis : "", // must use empty strings instead of "true":
// https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-gradle-plugin
models : ""
models : "",
generateSupportingFiles: "false",
skipDefaultInterface: "true",
supportingFiles: 'ApiUtil.java'
]
configOptions = [
interfaceOnly: "true",
useTags : "true",
generateSupportingFiles: "false",
skipDefaultInterface: "true"
useTags : "true"
]
}

Expand All @@ -72,11 +72,11 @@ processResources {
compileJava.dependsOn tasks.openApiGenerate

// set license format to ignore generated java sources
task licenseFormatJava(type: nl.javadude.gradle.plugins.license.License) {
task licenseFormatJava(type: License) {
source = fileTree('src/main/java')
}

task licenseTestJava(type: nl.javadude.gradle.plugins.license.License) {
task licenseTestJava(type: License) {
source = fileTree('src/main/java')
check = true
}
Expand Down Expand Up @@ -112,16 +112,15 @@ dependencies {
implementation project(':common-ui')
implementation project(':common-rest-api')


implementation('org.springframework.boot:spring-boot-starter-security')
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.data:spring-data-commons');
implementation('org.springframework.boot:spring-boot-starter-web:2.5.0')
implementation('org.springframework.data:spring-data-commons')
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation("org.springframework.boot:spring-boot-starter-cache")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation('org.springframework.cloud:spring-cloud-starter-sleuth')
implementation('org.kohsuke:libpam4j:1.11')
implementation('org.apache.commons:commons-compress:1.20')
implementation('org.apache.commons:commons-compress:1.21')
implementation('wsdl4j:wsdl4j:1.6.3')
implementation('com.github.vladimir-bukhtoyarov:bucket4j-core:4.10.0')
implementation("io.swagger.parser.v3:swagger-parser-v3:${swaggerParserVersion}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SuppressWarnings("checkstyle:HideUtilityClassConstructor")
@SpringBootApplication(scanBasePackages = { "org.niis.xroad.centralserver.restapi", "org.niis.xroad.restapi" })
@SpringBootApplication(scanBasePackages = {
"org.niis.xroad.centralserver.restapi",
"org.niis.xroad.restapi"
})
public class Main {
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* The MIT License
* <p>
* Copyright (c) 2019- Nordic Institute for Interoperability Solutions (NIIS)
* Copyright (c) 2018 Estonian Information System Authority (RIA),
* Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK)
* Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK)
* <p>
jhyoty marked this conversation as resolved.
Show resolved Hide resolved
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.niis.xroad.centralserver.restapi.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CurrentHAConfigStatus {

private static final String XROAD_HA_NODE_NAME_PROPERTY = "xroad.center.ha-node-name";
private static final String XROAD_HA_NODE_NAME_DEFAULT = "node_0";

@Bean
HAConfigStatus currentHaConfigStatus() {
boolean isHaConfigured = true;
String haNodeName;

haNodeName = getHaNodeNameProperty();
if (haNodeName.isEmpty()) {
isHaConfigured = false;
haNodeName = XROAD_HA_NODE_NAME_DEFAULT;
}
return new HAConfigStatus(haNodeName, isHaConfigured);
}

private String getHaNodeNameProperty() {
return System.getProperty(XROAD_HA_NODE_NAME_PROPERTY, "");
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* The MIT License
* <p>
* Copyright (c) 2019- Nordic Institute for Interoperability Solutions (NIIS)
* Copyright (c) 2018 Estonian Information System Authority (RIA),
* Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK)
* Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK)
* <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* <p>
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.niis.xroad.centralserver.restapi.config;

import lombok.Value;

@Value
public class HAConfigStatus {
String currentHaNodeName;
boolean isHaConfigured;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* The MIT License
* Copyright (c) 2019- Nordic Institute for Interoperability Solutions (NIIS)
* Copyright (c) 2018 Estonian Information System Authority (RIA),
* Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK)
* Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.niis.xroad.centralserver.restapi.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
* Enable customization of signer IP address when development profile is active.
* Otherwise use 127.0.0.1
*/
@Configuration
public class SignerIpAddressConfiguration {

@Value("${custom.signer.ip:127.0.0.1}")
private String customIp;

@SuppressWarnings("SameReturnValue")
@Bean(name = "signer-ip")
@Profile("!development")
public String defaultBean() {
return "127.0.0.1";
}

@Bean(name = "signer-ip")
@Profile("development")
public String customBean() {
return customIp;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* The MIT License
*
* Copyright (c) 2019- Nordic Institute for Interoperability Solutions (NIIS)
* Copyright (c) 2018 Estonian Information System Authority (RIA),
* Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK)
* Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.niis.xroad.centralserver.restapi.converter;

import org.niis.xroad.centralserver.openapi.model.InitializationStatus;
import org.niis.xroad.centralserver.openapi.model.TokenInitStatus;
import org.niis.xroad.centralserver.restapi.dto.InitializationStatusDto;
import org.springframework.stereotype.Component;

import static org.niis.xroad.centralserver.restapi.converter.TokenInitStatusMapping.map;

@Component
public class InitializationStatusConverter {

public InitializationStatus convert(InitializationStatusDto initializationStatusDto) {
InitializationStatus status = new InitializationStatus();
return status.centralServerAddress(initializationStatusDto.getCentralServerAddress())
.instanceIdentifier(initializationStatusDto.getInstanceIdentifier())
.softwareTokenInitStatus(map(initializationStatusDto.getTokenInitStatus())
.orElse(TokenInitStatus.UNKNOWN)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/**
* The MIT License
* Copyright (c) 2019- Nordic Institute for Interoperability Solutions (NIIS)
* Copyright (c) 2018 Estonian Information System Authority (RIA),
* Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK)
* Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.niis.xroad.centralserver.restapi.converter;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.niis.xroad.centralserver.openapi.model.TokenInitStatus;
import org.niis.xroad.centralserver.restapi.dto.TokenInitStatusInfo;


import java.util.Arrays;
import java.util.Optional;

/**
* Mapping between {@link TokenInitStatus} in api (enum) and model {@link TokenInitStatusInfo}
*/
@Getter
@RequiredArgsConstructor
public enum TokenInitStatusMapping {
INITIALIZED(TokenInitStatusInfo.INITIALIZED, TokenInitStatus.INITIALIZED),
NOT_INITIALIZED(TokenInitStatusInfo.NOT_INITIALIZED, TokenInitStatus.NOT_INITIALIZED),
UNKNOWN(TokenInitStatusInfo.UNKNOWN, TokenInitStatus.UNKNOWN);

private final TokenInitStatusInfo tokenInitStatusInfo;
private final TokenInitStatus tokenInitStatus;

/**
* Return matching {@link TokenInitStatusInfo}, if any
*
* @param tokenInitStatus to be mapped
*/
public static Optional<TokenInitStatusInfo> map(TokenInitStatus tokenInitStatus) {
return getFor(tokenInitStatus).map(TokenInitStatusMapping::getTokenInitStatusInfo);
}

/**
* Return matching {@link TokenInitStatus}, if any
*
* @param tokenInitStatusInfo to be mapped
*/
public static Optional<TokenInitStatus> map(TokenInitStatusInfo tokenInitStatusInfo) {
return getFor(tokenInitStatusInfo).map(TokenInitStatusMapping::getTokenInitStatus);
}

/**
* Return matching {@link TokenInitStatusMapping}, if any
*
* @param tokenInitStatusInfo for what mapping is requested
*/
public static Optional<TokenInitStatusMapping> getFor(TokenInitStatusInfo tokenInitStatusInfo) {
return Arrays.stream(values())
.filter(mapping -> mapping.tokenInitStatusInfo.equals(tokenInitStatusInfo))
.findFirst();
}

/**
* Return matching {@link TokenInitStatusMapping}, if any
*
* @param tokenInitStatus for what mapping is requested
*/
public static Optional<TokenInitStatusMapping> getFor(TokenInitStatus tokenInitStatus) {
return Arrays.stream(values())
.filter(mapping -> mapping.tokenInitStatus.equals(tokenInitStatus))
.findFirst();
}
}