zowe / sample-spring-boot-api-service

Zowe REST API service SDK and sample API service that integrates with Zowe API Mediation Layer
Other
26 stars 18 forks source link

Fail with better message when there is certificate error when connecting to API ML #10

Closed plavjanik closed 5 years ago

plavjanik commented 5 years ago

This PR adds "error handlers" for three types of problems that occur during the API ML integration:

  1. APIML does not trust the certificate of the service
  2. Service does not trust the APIML
  3. Another connection error

These errors are recognized by Logback TurboFilters and converted into better messages with IDs.

If the error happens before the service is started, then the service stops. This is dependent on timing. In the future, the condition will be the first registration to the APIML. That is dependent on https://github.com/zowe/api-layer/issues/307.

The package org.zowe.sdk will be moved to a standalone library in future and it will the SDK.

The numbered messages are defined in sdk-messages.yml with prefix ZWEAS for the SDK and messages.yml for the sample.

The "message guide" is in the MarkDown right now - https://github.com/zowe/sample-spring-boot-api-service/pull/10/files?short_path=a896298#diff-a8962988395966892dac23c5312fe0e6

codecov-io commented 5 years ago

Codecov Report

Merging #10 into master will decrease coverage by 3.7%. The diff coverage is 70%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #10      +/-   ##
============================================
- Coverage      82.2%   78.49%   -3.71%     
- Complexity       46       76      +30     
============================================
  Files            18       25       +7     
  Lines           118      186      +68     
  Branches          4       21      +17     
============================================
+ Hits             97      146      +49     
- Misses           15       26      +11     
- Partials          6       14       +8
Impacted Files Coverage Δ Complexity Δ
...ava/org/zowe/sdk/zos/security/SafPlatformUser.java 88.88% <ø> (ø) 3 <0> (?)
...we/sdk/zos/security/ZosAuthenticationProvider.java 76.47% <ø> (ø) 8 <0> (?)
...zowe/sdk/zos/security/SafPlatformClassFactory.java 0% <ø> (ø) 0 <0> (?)
...we/sample/apiservice/config/WebSecurityConfig.java 100% <ø> (ø) 3 <0> (ø) :arrow_down:
...e/sdk/zos/security/ZosAuthenticationException.java 75% <ø> (ø) 1 <0> (?)
...va/org/zowe/sdk/zos/security/MockPlatformUser.java 75% <ø> (ø) 3 <0> (?)
...e/sample/apiservice/ZoweApiServiceApplication.java 33.33% <0%> (ø) 1 <0> (ø) :arrow_down:
...rg/zowe/sdk/spring/ServiceStartupEventHandler.java 100% <100%> (ø) 3 <3> (?)
...we/sample/apiservice/config/ApplicationConfig.java 100% <100%> (ø) 3 <3> (?)
.../zowe/sdk/spring/EnableEurekaLoggingTimerTask.java 100% <100%> (ø) 3 <3> (?)
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b0227a0...38d69fe. Read the comment docs.

dkelosky commented 5 years ago

I get this now (which is very helpful): image

Old messaging was: image

dkelosky commented 5 years ago

I noticed that I initially got ZWEAS001E then 1 minute later I got ZWEAS002E. After leaving the service active for sometime, no other error messages occurred.

dkelosky commented 5 years ago

im going to need more time to block out and try the certificate generation and import - ill have to try that next week i think.