org.seedstack.seed.security.AuthenticationInfo Maven / Gradle / Ivy
/**
* Copyright (c) 2013-2016, The SeedStack authors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.security;
import org.seedstack.seed.security.principals.PrincipalProvider;
import org.seedstack.seed.security.principals.Principals;
import java.util.ArrayList;
import java.util.Collection;
/**
* Information about an authentication : the principals and credentials.
*
* @author [email protected]
*
*/
public class AuthenticationInfo {
private PrincipalProvider> identityPrincipal;
private Collection> otherPrincipals = new ArrayList>();
private Object credentials;
/**
* Constructor using Principal as identity principal.
*
* @param identityPrincipal
* identityPrincipal
* @param credentials
* credentials
*/
public AuthenticationInfo(PrincipalProvider> identityPrincipal, Object credentials) {
this.identityPrincipal = identityPrincipal;
this.credentials = credentials;
}
/**
* Constructor using String. Creates a SimplePrincipal with the id.
*
* @param id
* id
* @param credentials
* credentials
*/
public AuthenticationInfo(String id, Object credentials) {
this.identityPrincipal = Principals.identityPrincipal(id);
this.credentials = credentials;
}
/**
* Getter identityPrincipal
*
* @return the identityPrincipal
*/
public PrincipalProvider> getIdentityPrincipal() {
return identityPrincipal;
}
/**
* Getter otherPrincipals
*
* @return the otherPrincipals
*/
public Collection> getOtherPrincipals() {
return otherPrincipals;
}
/**
* Getter credentials
*
* @return the credentials
*/
public Object getCredentials() {
return credentials;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy