it seems to be something normal. I have been checking lot of examples, and no one is returning the username. Don't know why whoever developed this added a Subject tag then...
Subject.toString() returns the list of principals but no the authenticated user name
Question
[java] Logged in as Subject:
[java] Principal: write
[java] Principal: read
[java] Principal: delete
That's the output of javax.security.auth.Subject#toString()
. It's not returning the username, but it does return the principals properly.
What could be failing?
logincontext.login();
Subject subject = logincontext.getSubject();
System.out.println("Logged in as " + subject.toString());
edit: it seems to be something normal. I have been checking lot of examples, and no one is returning the username. Don't know why whoever developed this added a Subject tag then...
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow