net.sf.jguard.authentication
Class SubjectUtils

java.lang.Object
  extended by net.sf.jguard.authentication.SubjectUtils

public class SubjectUtils
extends java.lang.Object

utility class to query against subject credentials.

Author:
Charles Gay, Maximiliano Batelli

Constructor Summary
SubjectUtils()
           
 
Method Summary
static void addCredentialValue(javax.security.auth.Subject subject, boolean publicVisibility, java.lang.String credentialId, java.lang.Object credentialValue)
          adds new credential value if it does not already exist.
static java.lang.String getCredentialValueAsString(javax.security.auth.Subject subject, boolean publicVisibility, java.lang.String credentialId)
          return credential value from the specified credential set This function assume that credential have only one value return empty string if it is not found
static java.util.Collection getCredentialValues(javax.security.auth.Subject subject, boolean publicVisibility, java.lang.String credentialId)
          return credential values from the specified credential set which are mapped to the specified credentialId.
static java.util.Collection getCredentialValues(javax.security.auth.Subject subject, java.lang.String credentialId)
          return credential values from private and public credential set which are mapped to the specified credentialId.
static JGuardCredential getIdentityCredential(javax.security.auth.Subject subject, SubjectTemplate template)
           
static void setCredentialValue(javax.security.auth.Subject subject, boolean publicVisibility, java.lang.String credentialId, java.lang.Object credentialValue, boolean isIdentity)
          Set credential's value, this method assume that credential have only one value If credentialId exists then the value is replaced, else the credential is created
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubjectUtils

public SubjectUtils()
Method Detail

getCredentialValues

public static java.util.Collection getCredentialValues(javax.security.auth.Subject subject,
                                                       java.lang.String credentialId)
return credential values from private and public credential set which are mapped to the specified credentialId.

Parameters:
subject -
credentialId -
Returns:

getCredentialValues

public static java.util.Collection getCredentialValues(javax.security.auth.Subject subject,
                                                       boolean publicVisibility,
                                                       java.lang.String credentialId)
return credential values from the specified credential set which are mapped to the specified credentialId.

Parameters:
subject -
publicVisibility - true for publicCredentials, false for private credentials.
credentialId -
Returns:

getCredentialValueAsString

public static java.lang.String getCredentialValueAsString(javax.security.auth.Subject subject,
                                                          boolean publicVisibility,
                                                          java.lang.String credentialId)
return credential value from the specified credential set This function assume that credential have only one value return empty string if it is not found

Parameters:
subject -
publicVisibility - true for publicCredentials, false for private credentials.
credentialId -
Returns:

setCredentialValue

public static void setCredentialValue(javax.security.auth.Subject subject,
                                      boolean publicVisibility,
                                      java.lang.String credentialId,
                                      java.lang.Object credentialValue,
                                      boolean isIdentity)
Set credential's value, this method assume that credential have only one value If credentialId exists then the value is replaced, else the credential is created

Parameters:
subject -
publicVisibility - true for publicCredentials, false for private credentials.
credentialId -
credentialValue -

addCredentialValue

public static void addCredentialValue(javax.security.auth.Subject subject,
                                      boolean publicVisibility,
                                      java.lang.String credentialId,
                                      java.lang.Object credentialValue)
adds new credential value if it does not already exist. Added credential can not be an identity credential.

Parameters:
subject -
publicVisibility -
credentialId -
credentialValue -
isIdentity -

getIdentityCredential

public static JGuardCredential getIdentityCredential(javax.security.auth.Subject subject,
                                                     SubjectTemplate template)
                                              throws AuthenticationException
Throws:
AuthenticationException