microservices-oauth icon indicating copy to clipboard operation
microservices-oauth copied to clipboard

CustomPrincipal cannot be applied to java.lang.String

Open ken4ward opened this issue 5 years ago • 0 comments

Thank you for sharing this project. It's saved me a lot of effort. I ran the project and only one of them is failing. The snippet is this:

@Override
    public Authentication extractAuthentication(Map<String, ?> map) {
        if (map.containsKey(USERNAME))
            return new UsernamePasswordAuthenticationToken(
                    new CustomPrincipal(map.get(USERNAME).toString(), map.get(EMAIL).toString()), "N/A",
                    getAuthorities(map));
        return null;
    }

It kept on showing an error that CustomPrincipal cannot be applied to java.lang.String when the 2 variables.(USERNAME, EMAIL) are passed. Could you Kindly help look into it? THere's no constructor that accepts 2 arguments for CustomPrincipal, I think. My question is how come there are arguments passed into the constructor here? Please, help Thanks. God bless.

ken4ward avatar Sep 06 '19 02:09 ken4ward