File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
plugins/identity-shiro/src/main/java/org/opensearch/identity/shiro Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -83,14 +83,14 @@ public AuthcRestHandler(RestHandler original) {
83
83
84
84
@ Override
85
85
public void handleRequest (RestRequest request , RestChannel channel , NodeClient client ) throws Exception {
86
- final AuthToken token = RestTokenExtractor .extractToken (request );
87
- // If no token was found, continue executing the request
88
- if (token == null ) {
89
- // Authentication did not fail so return true. Authorization is handled at the action level.
90
- delegate .handleRequest (request , channel , client );
91
- return ;
92
- }
93
86
try {
87
+ final AuthToken token = RestTokenExtractor .extractToken (request );
88
+ // If no token was found, continue executing the request
89
+ if (token == null ) {
90
+ // Authentication did not fail so return true. Authorization is handled at the action level.
91
+ delegate .handleRequest (request , channel , client );
92
+ return ;
93
+ }
94
94
ShiroSubject shiroSubject = (ShiroSubject ) getSubject ();
95
95
shiroSubject .authenticate (token );
96
96
// Caller was authorized, forward the request to the handler
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ public OpenSearchRealm build() {
91
91
public User getInternalUser (final String principalIdentifier ) throws UnknownAccountException {
92
92
final User userRecord = internalUsers .get (principalIdentifier );
93
93
if (userRecord == null ) {
94
- throw new UnknownAccountException ();
94
+ throw new UnknownAccountException ("Incorrect credentials" );
95
95
}
96
96
return userRecord ;
97
97
}
@@ -129,7 +129,7 @@ protected AuthenticationInfo doGetAuthenticationInfo(final AuthenticationToken t
129
129
return sai ;
130
130
} else {
131
131
// Bad password
132
- throw new IncorrectCredentialsException ();
132
+ throw new IncorrectCredentialsException ("Incorrect credentials" );
133
133
}
134
134
}
135
135
You can’t perform that action at this time.
0 commit comments