
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
The newest version!
package com.daedafusion.security.authentication;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 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()
{
return principals.stream().anyMatch(AuthenticatedPrincipal::hasAssociations);
}
public Set getAttributeNames()
{
return principals.stream().flatMap(ap -> ap.getAttributeNames().stream()).collect(Collectors.toSet());
}
public Set getAttributes(String name)
{
return principals.stream().flatMap(ap -> ap.getAttributes(name).stream()).collect(Collectors.toSet());
}
public boolean isValid()
{
return principals.stream().allMatch(AuthenticatedPrincipal::isValid);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy