com.prosysopc.ua
Class UserIdentity

java.lang.Object
  extended by com.prosysopc.ua.SecureIdentity
      extended by com.prosysopc.ua.UserIdentity
Direct Known Subclasses:
ServerUserIdentity

public class UserIdentity
extends SecureIdentity

User identity definition. Different Type and Policy can be used for user authentication. According to Type, you can specify also Name & Password , certificate KeyPair or an external token in the constructor.

See Also:
ApplicationIdentity

Field Summary
protected  byte[] encryptedPassword
           
protected  byte[] issuedIdentityToken
           
protected  String name
           
protected static Map<String,org.opcfoundation.ua.core.UserTokenPolicy> policyMap
           
protected  org.opcfoundation.ua.core.UserTokenType type
           
 
Fields inherited from class com.prosysopc.ua.SecureIdentity
certificate, privateKey
 
Constructor Summary
UserIdentity()
          Create a default identity with Anonymous type.
UserIdentity(byte[] issuedIdentityToken)
          Create an identity with a token issued by an external security system.
UserIdentity(org.opcfoundation.ua.transport.security.Cert certificate, org.opcfoundation.ua.transport.security.PrivKey privateKey)
          Create an identity with a user certificate.
UserIdentity(File certificateFile, File privateKeyFile, String privateKeyPassword)
          Create an identity with a user certificate.
UserIdentity(String name, String password)
          Create an identity with user name & password.
UserIdentity(URL certificateFile, URL privateKeyFile, String privateKeyPassword)
          Create an identity with a user certificate.
 
Method Summary
protected  void decryptPassword(org.opcfoundation.ua.core.UserIdentityToken userIdentityToken, ApplicationIdentity serverIdentity, org.opcfoundation.ua.builtintypes.ByteString serverNonce, String algorithmUri)
           
 boolean equals(Object obj)
           
 boolean equals(Object obj, boolean requireSameType)
          Check that the identity equals to another identity with the same type or a different type.
 byte[] getEncryptedPassword()
           
 byte[] getIssuedIdentityToken()
           
 String getName()
           
 String getPassword()
           
 org.opcfoundation.ua.core.UserTokenType getType()
          The user token type defines which authentication method is used.
static org.opcfoundation.ua.core.UserTokenPolicy getUserTokenPolicy(String policyId)
          Return a constant UserTokenPolicy defined with policyId
 int hashCode()
           
 String toString()
           
 
Methods inherited from class com.prosysopc.ua.SecureIdentity
decrypt, decrypt, encrypt, getCertificate, getKeys, getPrivateKey
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

policyMap

protected static Map<String,org.opcfoundation.ua.core.UserTokenPolicy> policyMap

encryptedPassword

protected byte[] encryptedPassword

issuedIdentityToken

protected byte[] issuedIdentityToken

name

protected String name

type

protected org.opcfoundation.ua.core.UserTokenType type
Constructor Detail

UserIdentity

public UserIdentity()
Create a default identity with Anonymous type.


UserIdentity

public UserIdentity(byte[] issuedIdentityToken)
Create an identity with a token issued by an external security system.


UserIdentity

public UserIdentity(org.opcfoundation.ua.transport.security.Cert certificate,
                    org.opcfoundation.ua.transport.security.PrivKey privateKey)
Create an identity with a user certificate.


UserIdentity

public UserIdentity(File certificateFile,
                    File privateKeyFile,
                    String privateKeyPassword)
             throws IOException,
                    SecureIdentityException
Create an identity with a user certificate. The certificate and private keys is loaded from the files.

Parameters:
certificateFile - the file containing the user certificate
privateKeyFile - the file containing the user private key
privateKeyPassword - password used to secure the private key
Throws:
IOException - if the files cannot be read
SecureIdentityException - if the certificate or private key file is not valid

UserIdentity

public UserIdentity(String name,
                    String password)
Create an identity with user name & password.


UserIdentity

public UserIdentity(URL certificateFile,
                    URL privateKeyFile,
                    String privateKeyPassword)
             throws IOException,
                    SecureIdentityException
Create an identity with a user certificate. The certificate and private keys is loaded from the files.

Parameters:
certificateFile - the file containing the user certificate
privateKeyFile - the file containing the user private key
privateKeyPassword - password used to secure the private key
Throws:
IOException - if the files cannot be read
SecureIdentityException - if the certificate or private key file is not valid
Method Detail

getUserTokenPolicy

public static org.opcfoundation.ua.core.UserTokenPolicy getUserTokenPolicy(String policyId)
Return a constant UserTokenPolicy defined with policyId

Parameters:
policyId - The policyId, as available from UserIdentityToken, for example
Returns:
the UserTokenPolicy or null if no constant found

equals

public boolean equals(Object obj)
Overrides:
equals in class SecureIdentity

equals

public boolean equals(Object obj,
                      boolean requireSameType)
Check that the identity equals to another identity with the same type or a different type.

Parameters:
obj - the objects to compare this one to
requireSameType - whether the types must be the same as well. If false, then the fields are checked against another identity type.
Returns:
true if the objects are equal

getEncryptedPassword

public byte[] getEncryptedPassword()
Returns:
the encryptedPassword

getIssuedIdentityToken

public byte[] getIssuedIdentityToken()
Returns:
the issued token

getName

public String getName()
Returns:
the user name

getPassword

public String getPassword()
Returns:
the password

getType

public org.opcfoundation.ua.core.UserTokenType getType()
The user token type defines which authentication method is used. Alternatives are

Returns:
the type of user token

hashCode

public int hashCode()
Overrides:
hashCode in class SecureIdentity

toString

public String toString()
Overrides:
toString in class Object

decryptPassword

protected void decryptPassword(org.opcfoundation.ua.core.UserIdentityToken userIdentityToken,
                               ApplicationIdentity serverIdentity,
                               org.opcfoundation.ua.builtintypes.ByteString serverNonce,
                               String algorithmUri)
                        throws SecureIdentityException
Throws:
SecureIdentityException


Copyright © 2018. All rights reserved.