apache / submarine

Submarine is Cloud Native Machine Learning Platform.
https://submarine.apache.org/
Apache License 2.0
697 stars 252 forks source link

SUBMARINE-1294. Add simple type authentication for REST api #979

Closed cdmikechen closed 2 years ago

cdmikechen commented 2 years ago

What is this PR for?

Add simple type authentication for REST api.
Use pac4j for token generation and validation. Considering need to adapt to java8, this PR is using 4.5.6 instead of version pac4j 5 for the time being.

What type of PR is it?

Feature

Todos

What is the Jira issue?

https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-1294

How should this be tested?

Have added a test case in org.apache.submarine.server.security.SubmarineAuthSimpleTest

Screenshots (if appropriate)

No

Questions:

codecov[bot] commented 2 years ago

Codecov Report

Merging #979 (2fff5bd) into master (e7ed4a5) will increase coverage by 0.37%. The diff coverage is 70.00%.

@@             Coverage Diff             @@
##             master    #979      +/-   ##
===========================================
+ Coverage      9.18%   9.55%   +0.37%     
- Complexity      670     698      +28     
===========================================
  Files           234     240       +6     
  Lines         23716   23832     +116     
  Branches       3475    3478       +3     
===========================================
+ Hits           2178    2278     +100     
- Misses        21407   21420      +13     
- Partials        131     134       +3     
Impacted Files Coverage Δ
...a/org/apache/submarine/server/SubmarineServer.java 62.28% <20.00%> (-1.25%) :arrow_down:
.../submarine/server/rest/workbench/LoginRestApi.java 60.00% <57.14%> (+60.00%) :arrow_up:
...server/security/simple/SimpleSecurityProvider.java 66.66% <66.66%> (ø)
...submarine/server/security/common/CommonConfig.java 75.00% <75.00%> (ø)
...che/submarine/server/security/SecurityFactory.java 78.57% <78.57%> (ø)
...rine/server/security/simple/SimpleLoginConfig.java 87.50% <87.50%> (ø)
...submarine/server/security/simple/SimpleFilter.java 92.30% <92.30%> (ø)
...che/submarine/commons/utils/SubmarineConfVars.java 75.80% <100.00%> (+0.59%) :arrow_up:
...submarine/server/security/common/CommonFilter.java 100.00% <100.00%> (ø)
...ubmarine/commons/utils/SubmarineConfiguration.java 36.72% <0.00%> (+1.12%) :arrow_up:
... and 3 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 e7ed4a5...2fff5bd. Read the comment docs.