Class JonasIdentity
- java.lang.Object
-
- org.objectweb.joram.shared.security.Identity
-
- org.objectweb.joram.shared.security.jaas.JonasIdentity
-
- All Implemented Interfaces:
Streamable,Externalizable,Serializable
public class JonasIdentity extends Identity
JAAS identity class used to authenticate through JOnAS.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static StringJAAS_ENTRY_NAMEName used in the JOnAS JAAS config file.private static StringKEYSTORE_ALIASprivate static StringKEYSTORE_FILEprivate static StringKEYSTORE_PASSprivate LoginContextloginContextprivate Stringprincipalprivate PublicKeypublickeyprivate static longserialVersionUIDDefine serialVersionUID for interoperability.private Subjectsubjectprivate static StringUNSORT_ROLESprivate static StringUNTESTED_SIGNATURE
-
Constructor Summary
Constructors Constructor Description JonasIdentity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheck(Identity identity)check the identity.private StringgetPrincipal()private PublicKeygetPublicKey()private Object[]getRoles()private byte[]getSignature()StringgetUserName()Get the user name.private voidinitPublicKey()voidreadFrom(InputStream is)The object implements the readFrom method to restore its contents from the input stream.voidsetIdentity(String user, String passwd)set the identity.voidsetIdentity(String user, String passwd, String pJaasEntryName)sets the identity based on the user, password and the JAAS entry name.voidsetUserName(String userName)set user name.StringtoString()private booleanvalidate(PublicKey publickey, JonasIdentity identity)private booleanvalidate(JonasIdentity identity)voidwriteTo(OutputStream os)The object implements the writeTo method to write its contents to the output stream.-
Methods inherited from class org.objectweb.joram.shared.security.Identity
getRootIdentityClass, getRootName, read, readExternal, write, writeExternal
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Define serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
JAAS_ENTRY_NAME
private static final String JAAS_ENTRY_NAME
Name used in the JOnAS JAAS config file.- See Also:
- Constant Field Values
-
KEYSTORE_FILE
private static final String KEYSTORE_FILE
- See Also:
- Constant Field Values
-
KEYSTORE_PASS
private static final String KEYSTORE_PASS
- See Also:
- Constant Field Values
-
KEYSTORE_ALIAS
private static final String KEYSTORE_ALIAS
- See Also:
- Constant Field Values
-
UNTESTED_SIGNATURE
private static final String UNTESTED_SIGNATURE
- See Also:
- Constant Field Values
-
UNSORT_ROLES
private static final String UNSORT_ROLES
- See Also:
- Constant Field Values
-
principal
private String principal
-
subject
private Subject subject
-
loginContext
private LoginContext loginContext
-
publickey
private PublicKey publickey
-
-
Method Detail
-
setIdentity
public void setIdentity(String user, String passwd) throws Exception
Description copied from class:Identityset the identity.- Specified by:
setIdentityin classIdentity- Throws:
Exception
-
setIdentity
public void setIdentity(String user, String passwd, String pJaasEntryName) throws Exception
sets the identity based on the user, password and the JAAS entry name.- Parameters:
user- the usernamepasswd- the passwordpJaasEntryName- the JAAS entry name (within the JAAS configuration file).- Throws:
Exception- if an error occurs while trying to authenticate.
-
getUserName
public String getUserName()
Description copied from class:IdentityGet the user name.- Specified by:
getUserNamein classIdentity- Returns:
- username.
-
setUserName
public void setUserName(String userName)
Description copied from class:Identityset user name.- Specified by:
setUserNamein classIdentity
-
getPrincipal
private String getPrincipal()
-
getRoles
private Object[] getRoles()
- Returns:
-
getSignature
private byte[] getSignature()
- Returns:
-
validate
private boolean validate(JonasIdentity identity) throws Exception
- Throws:
Exception
-
validate
private boolean validate(PublicKey publickey, JonasIdentity identity) throws Exception
- Throws:
Exception
-
check
public boolean check(Identity identity) throws Exception
Description copied from class:Identitycheck the identity.
-
readFrom
public void readFrom(InputStream is) throws IOException
Description copied from interface:StreamableThe object implements the readFrom method to restore its contents from the input stream.- Parameters:
is- the stream to read data from in order to restore the object- Throws:
IOException- an error occurs during IO operation.
-
writeTo
public void writeTo(OutputStream os) throws IOException
Description copied from interface:StreamableThe object implements the writeTo method to write its contents to the output stream.- Parameters:
os- the stream to write the object to- Throws:
IOException- an error occurs during IO operation.
-
-