On branch 001-label-backend-spec
Changes to be committed: new file: src/main/java/com/label/common/shiro/BearerToken.java new file: src/main/java/com/label/common/shiro/ShiroConfig.java new file: src/main/java/com/label/common/shiro/TokenFilter.java new file: src/main/java/com/label/common/shiro/TokenPrincipal.java new file: src/main/java/com/label/common/shiro/UserRealm.java modified: src/main/java/com/label/common/statemachine/DatasetStatus.java new file: src/test/java/com/label/AbstractIntegrationTest.java new file: src/test/java/com/label/unit/StateMachineTest.java new file: src/test/resources/db/init.sql
This commit is contained in:
26
src/main/java/com/label/common/shiro/BearerToken.java
Normal file
26
src/main/java/com/label/common/shiro/BearerToken.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.label.common.shiro;
|
||||
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
|
||||
/**
|
||||
* Shiro AuthenticationToken wrapper for Bearer token strings.
|
||||
*/
|
||||
public class BearerToken implements AuthenticationToken {
|
||||
private final String token;
|
||||
private final TokenPrincipal principal;
|
||||
|
||||
public BearerToken(String token, TokenPrincipal principal) {
|
||||
this.token = token;
|
||||
this.principal = principal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPrincipal() {
|
||||
return principal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return token;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user