Added null check when adding credentials to Set (#2649)
Added null check when adding credentials to Set returned from getPrivateCredentials(). Fixes #2648 Signed-off-by: Sean Kavanagh <sean.p.kavanagh6@gmail.com>
This commit is contained in:
parent
eed55854e5
commit
83b2abebb7
|
@ -86,14 +86,18 @@ public abstract class AbstractLoginModule implements LoginModule
|
|||
public void setJAASInfo (Subject subject)
|
||||
{
|
||||
subject.getPrincipals().add(this.principal);
|
||||
subject.getPrivateCredentials().add(this.user.getCredential());
|
||||
if (this.user.getCredential() != null) {
|
||||
subject.getPrivateCredentials().add(this.user.getCredential());
|
||||
}
|
||||
subject.getPrincipals().addAll(roles);
|
||||
}
|
||||
|
||||
public void unsetJAASInfo (Subject subject)
|
||||
{
|
||||
subject.getPrincipals().remove(this.principal);
|
||||
subject.getPrivateCredentials().remove(this.user.getCredential());
|
||||
if (this.user.getCredential() != null) {
|
||||
subject.getPrivateCredentials().remove(this.user.getCredential());
|
||||
}
|
||||
subject.getPrincipals().removeAll(this.roles);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue