Error in Custom Realm X-Pack Oauth

After changing version from 5.4.1 to 5.5.1 I am getting Exception in below method

public User authenticate(AuthenticationToken authenticationToken) {
UsernamePasswordToken token = (UsernamePasswordToken) authenticationToken;
final String actualUser = token.principal();
final InfoHolder info = usersMap.get(actualUser);

if (info != null && SecuredString.constantTimeEquals(token.credentials(), info.password)) {
    return new User(actualUser, info.roles);
return null;

Error is:

[INFO] ------------------------------------------------------------------------
[INFO] Total time: 39.197 s
[INFO] Finished at: 2018-03-13T14:25:24+05:30
[INFO] Final Memory: 25M/66M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5:compile (default-compile) on project shieldOAuth: Compilation failure: Compilation failure:
[ERROR] D:...\x-pack-custom-realm\src\main\java\org\elasticsearch\example\realm\[30,53] error: cannot find symbol
[ERROR] symbol: class SecuredString
[ERROR] location: package
[ERROR] D:...\x-pack-custom-realm\src\main\java\org\elasticsearch\example\realm\[26,53] error: cannot find symbol
[ERROR] -> [Help 1]

Secured class in not available in other ES versions What should I use instead of
SecuredString.constantTimeEquals(token.credentials(), info.password)

Please suggest what to do in this case?

In 5.5 the xpack SecuredString was replaced with org.elasticsearch.common.settings.SecureString, for which the equals method is constant time.

The 5.5 branch of the sample code has this change

Please tell what to use in place of this

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.