-
Notifications
You must be signed in to change notification settings - Fork 525
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
add LoginAPI #1500
add LoginAPI #1500
Conversation
hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/AuthenticationFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/AuthenticationFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/auth/StandardAuthManager.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/auth/UserWithRole.java
Outdated
Show resolved
Hide resolved
|
||
@Watched(prefix = "cache") | ||
@Override | ||
public boolean update(K id, V value, long timeOffset) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebase master
hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/auth/TokenGenerator.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/auth/TokenGenerator.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/AuthenticationFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/AuthenticationFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/auth/TokenGenerator.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/AuthenticationFilter.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #1500 +/- ##
============================================
- Coverage 60.78% 59.22% -1.56%
- Complexity 675 6124 +5449
============================================
Files 423 410 -13
Lines 35051 33213 -1838
Branches 4967 4587 -380
============================================
- Hits 21305 19670 -1635
+ Misses 11601 11478 -123
+ Partials 2145 2065 -80
Continue to review full report at Codecov.
|
to add api test |
a7cbbb3
to
f40e567
Compare
hugegraph-test/src/main/java/com/baidu/hugegraph/api/LoginApiTest.java
Outdated
Show resolved
Hide resolved
also bump api version |
hugegraph-api/src/main/java/com/baidu/hugegraph/version/ApiVersion.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/com/baidu/hugegraph/api/LoginApiTest.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java
Outdated
Show resolved
Hide resolved
public RolePermission loginUser(String username, String password); | ||
public String loginUser(String username, String password) | ||
throws AuthenticationException; | ||
public void logoutUser(String token); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe better to return boolean, same as the logout-api / client (or unify with DELETE api together to make user friendly)
public StandardAuthManager(HugeGraphParams graph) { | ||
E.checkNotNull(graph, "graph"); | ||
|
||
this.graph = graph; | ||
this.eventListener = this.listenChanges(); | ||
this.usersCache = this.cache("users"); | ||
this.pwdCache = this.cache("users_pwd"); | ||
this.tokenCache = this.cache("token"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the token expired for 1day by default? (or set to 1h?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1h is too short, no token refresh in current version
Use HS256 generator token, token payload have
user_name
anduser_id
.