Skip to content

Commit ad17c18

Browse files
authored
feat: accept PAT for SSO (#2499)
* include PAT in SSO Signed-off-by: achmelo <a.chmelo@gmail.com> * PAT ITs Signed-off-by: achmelo <a.chmelo@gmail.com> * separate cookie for PAT Signed-off-by: achmelo <a.chmelo@gmail.com> * parse PAT with signature Signed-off-by: achmelo <a.chmelo@gmail.com> * exclude infinispan tests from zosmftests Signed-off-by: achmelo <a.chmelo@gmail.com> * export infinispan coverage results, fix code smells, PAT feature flag Signed-off-by: achmelo <a.chmelo@gmail.com> * PAT feature flag Signed-off-by: achmelo <a.chmelo@gmail.com> * styles Signed-off-by: achmelo <a.chmelo@gmail.com> * parsed auth source refactoring Signed-off-by: achmelo <a.chmelo@gmail.com> * pat source service unit tests Signed-off-by: achmelo <a.chmelo@gmail.com> * code review comments, additional tests, feature flag in start script Signed-off-by: achmelo <a.chmelo@gmail.com> * do not return null when parsing pat Signed-off-by: achmelo <a.chmelo@gmail.com>
1 parent 16ca734 commit ad17c18

File tree

42 files changed

+736
-175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+736
-175
lines changed

.github/workflows/containers.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,7 @@ jobs:
10351035
name: CITestsWithInfinispan-${{ env.JOB_ID }}
10361036
path: |
10371037
integration-tests/build/reports/**
1038+
results/**
10381039
10391040
- uses: ./.github/actions/teardown
10401041

apiml-security-common/src/main/java/org/zowe/apiml/security/common/config/AuthConfigurationProperties.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public static class TokenProperties {
8080
@Data
8181
public static class CookieProperties {
8282
private String cookieName = ApimlConstants.COOKIE_AUTH_NAME;
83+
private String cookieNamePAT = ApimlConstants.PAT_COOKIE_AUTH_NAME;
8384
private boolean cookieSecure = true;
8485
private String cookiePath = "/";
8586
private String cookieComment = "API Mediation Layer security token";

common-service-core/src/main/java/org/zowe/apiml/constants/ApimlConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ private ApimlConstants() {
2222
public static final String BASIC_AUTHENTICATION_PREFIX = "Basic";
2323
public static final String BEARER_AUTHENTICATION_PREFIX = "Bearer";
2424
public static final String COOKIE_AUTH_NAME = "apimlAuthenticationToken";
25+
public static final String PAT_COOKIE_AUTH_NAME = "personalAccessToken";
26+
public static final String PAT_HEADER_NAME = "PRIVATE-TOKEN";
2527
}

config/docker/gateway-service.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ apiml:
44
discoveryServiceUrls: https://discovery-service:10011/eureka/
55
security:
66
allowTokenRefresh: true
7+
personalAccessToken:
8+
enabled: true
79
auth:
810
zosmf:
911
serviceId: mockzosmf # Replace me with the correct z/OSMF service id

config/local-multi/gateway-service-1.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ apiml:
66
port: 10010
77
discoveryServiceUrls: https://localhost:10011/eureka/,https://localhost2:10021/eureka/
88
security:
9+
personalAccessToken:
10+
enabled: true
911
auth:
1012
provider: zosmf
1113
zosmf:

config/local-multi/gateway-service-2.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ apiml:
66
port: 10020
77
discoveryServiceUrls: https://localhost:10011/eureka/,https://localhost2:10021/eureka/
88
security:
9+
personalAccessToken:
10+
enabled: true
911
auth:
1012
provider: zosmf
1113
zosmf:

config/local/gateway-service.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ apiml:
77
discoveryServiceUrls: https://localhost:10011/eureka/
88
security:
99
allowTokenRefresh: true
10+
personalAccessToken:
11+
enabled: true
1012
auth:
1113
provider: zosmf
1214
zosmf:

gateway-package/src/main/resources/bin/start.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ _BPX_JOBNAME=${ZWE_zowe_job_prefix}${GATEWAY_CODE} java \
186186
-Dapiml.security.ssl.nonStrictVerifySslCertificatesOfServices=${nonStrictVerifySslCertificatesOfServices:-false} \
187187
-Dapiml.security.auth.zosmf.serviceId=${ZWE_configs_apiml_security_auth_zosmf_serviceId:-zosmf} \
188188
-Dapiml.security.auth.provider=${ZWE_configs_apiml_security_auth_provider:-zosmf} \
189+
-Dapiml.security.personalAccessToken.enabled=${ZWE_configs_apiml_security_personalAccessToken_enabled:-false} \
189190
-Dapiml.zoweManifest=${ZWE_zowe_runtimeDirectory}/manifest.json \
190191
-Dserver.address=0.0.0.0 \
191192
-Dserver.maxConnectionsPerRoute=${ZWE_configs_server_maxConnectionsPerRoute:-100} \

gateway-service/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ dependencies {
169169

170170
testImplementation(testFixtures(project(":integration-tests")))
171171

172-
runtime libraries.jjwt_impl
172+
implementation libraries.jjwt_impl
173173
runtime libraries.jjwt_jackson
174174
}
175175

gateway-service/src/main/java/org/zowe/apiml/gateway/error/check/TimeoutErrorCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public ResponseEntity<ApiMessageView> checkError(HttpServletRequest request, Thr
3939
Throwable rootCause = ExceptionUtils.getRootCause(zuulException);
4040

4141
if ((zuulException.nStatusCode == HttpStatus.GATEWAY_TIMEOUT.value())
42-
|| zuulException.errorCause.equals(ERROR_CAUSE_TIMEOUT)) {
42+
|| ERROR_CAUSE_TIMEOUT.equals(zuulException.errorCause)) {
4343
Throwable cause = zuulException.getCause();
4444
String causeMessage;
4545
if (cause != null) {

0 commit comments

Comments
 (0)