Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

PeerAuthenticator not getting called #203

Open
ShaimaaSabry opened this issue May 12, 2021 · 0 comments
Open

PeerAuthenticator not getting called #203

ShaimaaSabry opened this issue May 12, 2021 · 0 comments

Comments

@ShaimaaSabry
Copy link

ShaimaaSabry commented May 12, 2021

Here is my PeerAuthenticator class:

public class TokenPeerAuthenticator implements PeerAuthenticator {
    Configuration configuration = Configuration.get();

    @Override
    public boolean authenticate(HttpServletRequest request) {
        String requiredToken = configuration.getAuthToken();

        String authorizationHeader = request.getHeader("Authorization");
        if(authorizationHeader == null) {
            return false;
        }

        String token = authorizationHeader.replace("Bearer ", "");
        if(token.equals(requiredToken)) {
            return true;
        }
        
        return false;
    }
}

and this my API:

@Api(name = "api", version = "v1", peerAuthenticators = TokenPeerAuthenticator.class)
public class UserAPI {
...
}

My PeerAuthenticator is not getting called. Please advice.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant