File tree Expand file tree Collapse file tree 4 files changed +0
-33
lines changed
plugins/identity-shiro/src
main/java/org/opensearch/identity/shiro
test/java/org/opensearch/identity/shiro
server/src/main/java/org/opensearch/identity Expand file tree Collapse file tree 4 files changed +0
-33
lines changed Original file line number Diff line number Diff line change 1010
1111import org .apache .logging .log4j .LogManager ;
1212import org .apache .logging .log4j .Logger ;
13- import org .apache .shiro .SecurityUtils ;
1413import org .apache .shiro .authc .AuthenticationToken ;
1514import org .apache .shiro .authc .UsernamePasswordToken ;
1615import org .opensearch .common .Randomness ;
1716import org .opensearch .identity .IdentityService ;
1817import org .opensearch .identity .Subject ;
19- import org .opensearch .identity .noop .NoopSubject ;
2018import org .opensearch .identity .tokens .AuthToken ;
2119import org .opensearch .identity .tokens .BasicAuthToken ;
2220import org .opensearch .identity .tokens .OnBehalfOfClaims ;
@@ -88,20 +86,6 @@ public AuthToken issueServiceAccountToken(String audience) {
8886 return token ;
8987 }
9088
91- @ Override
92- public Subject authenticateToken (AuthToken authToken ) {
93- return new NoopSubject ();
94- }
95-
96- public boolean validateToken (AuthToken token ) {
97- if (token instanceof BasicAuthToken ) {
98- final BasicAuthToken basicAuthToken = (BasicAuthToken ) token ;
99- return basicAuthToken .getUser ().equals (SecurityUtils .getSubject ().toString ())
100- && basicAuthToken .getPassword ().equals (shiroTokenPasswordMap .get (basicAuthToken ));
101- }
102- return false ;
103- }
104-
10589 public String getTokenInfo (AuthToken token ) {
10690 if (token instanceof BasicAuthToken ) {
10791 final BasicAuthToken basicAuthToken = (BasicAuthToken ) token ;
Original file line number Diff line number Diff line change @@ -100,11 +100,6 @@ public void testShouldFailGetTokenInfo() {
100100 assertThrows (UnsupportedAuthenticationToken .class , () -> shiroAuthTokenHandler .getTokenInfo (bearerAuthToken ));
101101 }
102102
103- public void testShouldFailValidateToken () {
104- final BearerAuthToken bearerAuthToken = new BearerAuthToken ("header.payload.signature" );
105- assertFalse (shiroAuthTokenHandler .validateToken (bearerAuthToken ));
106- }
107-
108103 public void testShoudPassMapLookupWithToken () {
109104 final BasicAuthToken authToken = new BasicAuthToken ("Basic dGVzdDp0ZTpzdA==" );
110105 shiroAuthTokenHandler .getShiroTokenPasswordMap ().put (authToken , "te:st" );
Original file line number Diff line number Diff line change @@ -50,9 +50,4 @@ public String asAuthHeaderValue() {
5050 }
5151 };
5252 }
53-
54- @ Override
55- public Subject authenticateToken (AuthToken authToken ) {
56- return null ;
57- }
5853}
Original file line number Diff line number Diff line change @@ -30,11 +30,4 @@ public interface TokenManager {
3030 * @return a new auth token
3131 */
3232 public AuthToken issueServiceAccountToken (final String audience );
33-
34- /**
35- * Authenticates a provided authToken
36- * @param authToken: The authToken to authenticate
37- * @return The authenticated subject
38- */
39- public Subject authenticateToken (AuthToken authToken );
4033}
You can’t perform that action at this time.
0 commit comments