@Override
    public String authenticate(AuthenticationDataSource authData) throws AuthenticationException {
        String token;
        try {
            // Get Token
            token = getToken(authData);
        } catch (AuthenticationException exception) {
            incrementFailureMetric(ErrorCode.INVALID_AUTH_DATA);
            throw exception;
        }
        // Parse Token by validating
        String role = getPrincipal(authenticateToken(token));
        AuthenticationMetrics.authenticateSuccess(getClass().getSimpleName(), getAuthMethodName());
        return role;
    }
@Test(expectedExceptions = AuthenticationException.class)
    public void testAuthenticateWhenAuthHeaderValuePrefixIsInvalid() throws AuthenticationException {
        AuthenticationProviderToken provider = new AuthenticationProviderToken();
        provider.authenticate(new AuthenticationDataSource() {
            @Override
            public String getHttpHeader(String name) {
                return "MyBearer ";
            }

            @Override
            public boolean hasDataFromHttp() {
                return true;
            }
        });
    }