
com.daedafusion.security.authentication.Subject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of security-framework Show documentation
Show all versions of security-framework Show documentation
A pluggable security framework "inspired" by the OWASP ESAPI framework
package com.daedafusion.security.authentication;
import java.util.HashSet;
import java.util.Set;
/**
* Created by mphilpot on 7/11/14.
*/
public final class Subject
{
private Set principals;
protected Subject(Set authPrincipals)
{
this.principals = authPrincipals;
}
public Set getPrincipals()
{
return principals;
}
public boolean hasAttributes()
{
for(AuthenticatedPrincipal ap : principals)
{
if(ap.hasAttributes())
{
return true;
}
}
return false;
}
public Set getAttributeNames()
{
Set result = new HashSet<>();
for(AuthenticatedPrincipal ap : principals)
{
result.addAll(ap.getAttributeNames());
}
return result;
}
public Set getAttributes(String name)
{
for(AuthenticatedPrincipal ap : principals)
{
if(ap.getAttributeNames().contains(name))
{
return ap.getAttributes(name);
}
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy