com.waveset.adapter
Class AuthSSOResourceAdapter

java.lang.Object
  extended bycom.waveset.adapter.ResourceAdapterBase
      extended bycom.waveset.adapter.AuthSSOResourceAdapter
All Implemented Interfaces:
ResourceAdapter

public class AuthSSOResourceAdapter
extends ResourceAdapterBase


Nested Class Summary
static class AuthSSOResourceAdapter.AuthSSOAccountIterator
          The implementation of the AccountIterator returned by getAccountIterator.
 
Nested classes inherited from class com.waveset.adapter.ResourceAdapterBase
ResourceAdapterBase.SimpleAccountIterator
 
Nested classes inherited from class com.waveset.adapter.ResourceAdapter
ResourceAdapter.ActionResult, ResourceAdapter.Features, ResourceAdapter.ObjectType
 
Field Summary
static java.lang.String AA_BA_PASSWORD
          The name of the department the account owner is in.
static java.lang.String AA_BA_USERID
          Basic auth user id.
static java.lang.String AA_DISCLAIMER
          Dislaimer.
static java.lang.String AA_DISCLAIMER_FILE
          Disclaimer file
static java.lang.String AA_EXTRANET
          Extranet
static java.lang.String AA_EXTRANET_FILE
          Extranet file
static java.lang.String AA_FIRST_NAME
          First name
static java.lang.String AA_LAST_NAME
          Last name
static java.lang.String AA_ROLES
          Roles
static java.lang.String AA_STATUS
          Status
static java.lang.String AA_USERNO
          The user number.
static java.lang.String code_id
           
static boolean debug
           
static java.lang.String DEFAULT_DRIVER
          The default value for the RA_DRIVER resource attribute.
static java.lang.String DEFAULT_URL
          The default value for the JDBC url prefix.
static java.lang.String RA_DATABASE
          The name of the database to connect to.
static java.lang.String RA_DRIVER
          The class name of the JDBC driver.
static java.lang.String RA_HOST
          The name of the host used on which the server is listening.
static java.lang.String RA_PASSWORD
          The password for the system account used to access the resource.
static java.lang.String RA_PORT
          The port on which the server is listening.
static java.lang.String RA_ROLES
          The optional role(s) to assign to accounts created by this adapter.
static java.lang.String RA_URL
          The JDBC driver url prefix Each driver will have a particular prefix they expect when formatting the url passed to the JDBC getConnection method.
static java.lang.String RA_USER
          The system account name used to access the resource.
 
Fields inherited from class com.waveset.adapter.ResourceAdapterBase
_cache, _context, _excludedAccountsRule, _excludedAccountsRuleInited, _listAllObjectsAttrParse, _listAllObjectsAttrParseName, _listUserAttrParse, _listUserAttrParseName, _listUserGroupsAttrParse, _listUserGroupsAttrParseName, _resource, _thread, _trace, displayInfoCode, RA_BLOCKCOUNT, RA_LOGIN_ACTION, RA_LOGOFF_ACTION, RA_MULTI_VALUED_ATTRS, RA_TEST_MODE
 
Fields inherited from interface com.waveset.adapter.ResourceAdapter
CHANGE_PASSWORD_LOCATION, DISABLE, ENABLE, EXPIRE_PASSWORD, GUID, IGNORE_ATTR, NEW_ACCOUNT_ID, OP_DAYS_INACTIVE, OP_DISABLED, OP_DORMANT, OP_EXPIRED, OP_EXPIREDPWD, OP_INACTIVE, OP_LOCKED, OP_NO_PASSWORD_SET, OP_NOOWNERSHIP, OP_NOPASSWORDREQ, OP_NUMINACTIVEDAYS, OP_NUMPWDAYS, OP_PWNUMDAYS, RA_BASE_CTX, RA_DISPLAY_NAME_ATTR, RA_NEW_OBJECT_ID, RA_NEW_OBJECT_NAME, RA_OBJECT_ATTRIBUTES, RA_OBJECT_CLASS, RA_OBJECT_ID, RA_OBJECT_TYPE, RA_OP_TYPE, RA_RENAME_OP, RA_REQUESTOR, RA_SAVEAS_OP, RA_SEARCH_ATTRIBUTE_NAMES, RA_SEARCH_ATTRS_TO_GET, RA_SEARCH_CONTEXT, RA_SEARCH_FILTER, RA_SEARCH_RUN_AS_PASSWORD, RA_SEARCH_RUN_AS_USER, RA_SEARCH_SCOPE, RA_SEARCH_SCOPE_OBJECT, RA_SEARCH_SCOPE_ONE_LEVEL, RA_SEARCH_SCOPE_SUBTREE, RA_SEARCH_TIME_LIMIT, RESET_PASSWORD, SYSTEM_ATTRIBUTES, UNLOCK, WS_USER_PASSWORD
 
Constructor Summary
AuthSSOResourceAdapter()
          Create an adapater instance, without a resource.
AuthSSOResourceAdapter(Resource res, ObjectCache cache)
          Create an adapter instance for a resource.
 
Method Summary
 void addAttributeValue(java.lang.StringBuffer b, WSUser user, java.lang.String attname)
          Helper method for building the values() list for an insert statement from account attributes.
 void addQuoted(java.lang.StringBuffer b, java.lang.String s)
          Add a quoted string to a SQL statement we're building in a buffer.
 WavesetResult authenticate(java.util.HashMap loginInfo)
          Check to see if a user account and password is valid.
 WSUser buildUser(java.lang.String id)
          Build the base user object given an id.
 WavesetResult checkCreateAccount(WSUser user)
          Check to see if an account can be created.
 WavesetResult checkDeleteAccount(WSUser user)
          Check account deletion.
 WavesetResult checkUpdateAccount(WSUser user)
          Check the ability to perform an account update.
 void closeConnection(java.sql.Connection con)
          Close a connection, quietly.
 void closeResult(java.sql.ResultSet res)
          Close a result, quietly.
 void closeStatement(java.sql.PreparedStatement stmt)
          Close a statement, quietly.
 Resource createPrototypeResource()
          Create the prototype instance.
 WSAttributes getAccountAttributes(java.lang.String accountIdentity)
          Deprecated method, use getUser instead.
 AccountIterator getAccountIterator()
          Return an iterator that will iterate over all the accounts on a resource.
 java.lang.String getColumn(java.sql.ResultSet result, int col)
          Get a string from a result set, trimming trailing blanks.
 void getColumn(java.sql.ResultSet res, int column, WSUser user, java.lang.String attname)
           
 WSUser getUser(WSUser user)
          Public adapter method to get the current user information.
 int queryInt(java.sql.Connection c, java.lang.String q, java.lang.String arg)
          Run a query and return an expected integer in the first column of the first row.
 java.lang.String queryString(java.sql.Connection c, java.lang.String q, java.lang.String arg)
          Run a query and return an expected string in the first column of the first row.
protected  void realCreate(WSUser user, WavesetResult result)
          Create a new account.
protected  void realDelete(WSUser user, WavesetResult result)
          Delete the account for real.
protected  void realUpdate(WSUser user, WavesetResult result)
          Perform the actual account update.
 void startConnection()
          Needs to be overridden by subclass if default createAccounts() implementation is used.
static Resource staticCreatePrototypeResource()
          Create the prototype instance.
 void stopConnection()
          Needs to be overridden by subclass if default createAccounts() implementation is used.
 
Methods inherited from class com.waveset.adapter.ResourceAdapterBase
checkForNoPasswordInSchema, checkSyntax, createAccount, createAccounts, createIdentity, createObject, deleteAccount, deleteAccount, deleteAccounts, deleteObject, disableAccount, disableAccounts, dnsEqual, dnsEqual, enableAccount, enableAccounts, executeResourceAttributeJavascriptAction, fillInResourceInfo, fillInResourceInfo, getAccountIterator, getAccountIterator, getAction, getActionNotFoundErrorMessage, getActionNotFoundMessage, getActionRunAsPassword, getActionRunAsUser, getActionTimeout, getActionType, getAdapter, getAdapter, getAdapter, getAdapterProxy, getAdapterProxy, getAllAccounts, getAttrNameFromMapName, getAttrNameFromMapName, getAttrParse, getAttrTypeFromMapName, getAttrTypeFromMapName, getAUserName, getBaseContextAttrName, getBaseContextObject, getBaseContexts, getBlockSize, getContext, getExcludedAccountsRule, getFeatures, getIdentity, getListAllObjectsAttrParse, getListUserAttrParse, getListUserGroupsAttrParse, getObject, getOptionalBooleanResAttrVal, getOptionalBooleanResAttrVal, getOptionalEncryptedResAttrVal, getOptionalResAttrVal, getOptionalStringResAttrVal, getRequiredResAttr, getRequiredResAttr, getRequiredResAttrVal, getRequiredResAttrVal, getRequiredResAttrVals, getRequiredUserAttributeNames, getResAttrValActionOnUser, getResAttrVals, getResource, getResourceAccounts, getResourceInfo, getResourceObjectAttrValNameAttr, getResourceObjectClassAttr, getResourceObjectTypePrefix, getSchemaMap, getUser, getWSAttrByMapName, getWSAttrByMapName, getWSAttrFromMap, handleActionResult, handleJavascriptActionResult, isAccountAttributeSecret, isExcludedAccount, isExcludedAccount, isFeatureEnabled, isSupported, isTestMode, listAllObjects, listAllObjects, listObjects, listObjects, listObjectsOfType, lookupAction, lookupAction, lookupActions, namesEqual, objectClassesMatchType, println, realDisable, realEnable, restoreResourceObjectClassAttr, run, run, runResourceAttributeJavascriptAction, scan, setCache, setContext, setDisabled, setFromResource, setResource, setResourceObjectClassAttr, setResourceOptionAttrs, startConnectionWrapper, supportsAccountActions, supportsAccountDisable, supportsActions, supportsCaseInsensitiveAccountIds, supportsContainerObjectTypes, supportsExcludedAccounts, supportsResourceAccount, supportsScanning, testConfiguration, updateAccount, updateAccounts, updateObject, updateResourceAccount, updateResourceIdentity, vmStoreBoot, vmStoreGet, vmStoreInit, vmStoreLatch, vmStorePut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

RA_DRIVER

public static final java.lang.String RA_DRIVER
The class name of the JDBC driver. You do not necessarily need to expose this as a resource attribute, but it can be convenient if you want to evaluate different drivers, or switch between different database vendors.

See Also:
Constant Field Values

DEFAULT_DRIVER

public static final java.lang.String DEFAULT_DRIVER
The default value for the RA_DRIVER resource attribute. We will be using a Sybase database in this example.

See Also:
Constant Field Values

RA_URL

public static final java.lang.String RA_URL
The JDBC driver url prefix Each driver will have a particular prefix they expect when formatting the url passed to the JDBC getConnection method. Note, that some drivers also have specific syntax requirements for the remainder of the URL, there doesn't appear to be a universal standard. If you need to switch between drivers from different vendors, you may also need to expose a resource attribute

See Also:
Constant Field Values

DEFAULT_URL

public static final java.lang.String DEFAULT_URL
The default value for the JDBC url prefix.

See Also:
Constant Field Values

RA_HOST

public static final java.lang.String RA_HOST
The name of the host used on which the server is listening.

See Also:
Constant Field Values

RA_PORT

public static final java.lang.String RA_PORT
The port on which the server is listening.

See Also:
Constant Field Values

RA_DATABASE

public static final java.lang.String RA_DATABASE
The name of the database to connect to. Most systems typically have a single server process listening on a port, that serves as a connection gateway for multiple databases. If the database you're connecting to is implied by the combination of host & port, then you do not need to expose this attribute.

See Also:
Constant Field Values

RA_USER

public static final java.lang.String RA_USER
The system account name used to access the resource. This user must have sufficient privileges to perform the SQL statements embedded in the adapter.

See Also:
Constant Field Values

RA_PASSWORD

public static final java.lang.String RA_PASSWORD
The password for the system account used to access the resource.

See Also:
Constant Field Values

RA_ROLES

public static final java.lang.String RA_ROLES
The optional role(s) to assign to accounts created by this adapter. Roles are defined as both a resource attribute and an account attribute in this example. If a role list is specified in the resource attribute, then all users will have at least the specified roles. If a role list is also specified in the account attribute, the two lists will be merged.

See Also:
Constant Field Values

debug

public static final boolean debug
See Also:
Constant Field Values

AA_USERNO

public static final java.lang.String AA_USERNO
The user number. We'll make this be an account attribute so it can be displayed, but it is auto generated and will never be updated.

See Also:
Constant Field Values

AA_BA_USERID

public static final java.lang.String AA_BA_USERID
Basic auth user id.

See Also:
Constant Field Values

AA_BA_PASSWORD

public static final java.lang.String AA_BA_PASSWORD
The name of the department the account owner is in.

See Also:
Constant Field Values

AA_DISCLAIMER

public static final java.lang.String AA_DISCLAIMER
Dislaimer.

See Also:
Constant Field Values

AA_EXTRANET

public static final java.lang.String AA_EXTRANET
Extranet

See Also:
Constant Field Values

AA_DISCLAIMER_FILE

public static final java.lang.String AA_DISCLAIMER_FILE
Disclaimer file

See Also:
Constant Field Values

AA_EXTRANET_FILE

public static final java.lang.String AA_EXTRANET_FILE
Extranet file

See Also:
Constant Field Values

AA_FIRST_NAME

public static final java.lang.String AA_FIRST_NAME
First name

See Also:
Constant Field Values

AA_LAST_NAME

public static final java.lang.String AA_LAST_NAME
Last name

See Also:
Constant Field Values

AA_STATUS

public static final java.lang.String AA_STATUS
Status

See Also:
Constant Field Values

AA_ROLES

public static final java.lang.String AA_ROLES
Roles

See Also:
Constant Field Values
Constructor Detail

AuthSSOResourceAdapter

public AuthSSOResourceAdapter(Resource res,
                              ObjectCache cache)
Create an adapter instance for a resource.


AuthSSOResourceAdapter

public AuthSSOResourceAdapter()
Create an adapater instance, without a resource.

Method Detail

staticCreatePrototypeResource

public static Resource staticCreatePrototypeResource()
                                              throws WavesetException
Create the prototype instance.

Throws:
WavesetException

createPrototypeResource

public Resource createPrototypeResource()
                                 throws WavesetException
Create the prototype instance.

Specified by:
createPrototypeResource in interface ResourceAdapter
Specified by:
createPrototypeResource in class ResourceAdapterBase
Throws:
WavesetException

startConnection

public void startConnection()
                     throws WavesetException
Description copied from class: ResourceAdapterBase
Needs to be overridden by subclass if default createAccounts() implementation is used.

Overrides:
startConnection in class ResourceAdapterBase
Throws:
WavesetException

stopConnection

public void stopConnection()
                    throws WavesetException
Description copied from class: ResourceAdapterBase
Needs to be overridden by subclass if default createAccounts() implementation is used.

Overrides:
stopConnection in class ResourceAdapterBase
Throws:
WavesetException

addQuoted

public void addQuoted(java.lang.StringBuffer b,
                      java.lang.String s)
Add a quoted string to a SQL statement we're building in a buffer.


checkCreateAccount

public WavesetResult checkCreateAccount(WSUser user)
                                 throws WavesetException
Check to see if an account can be created. We ping the server and see if the user already exists.

Specified by:
checkCreateAccount in interface ResourceAdapter
Specified by:
checkCreateAccount in class ResourceAdapterBase
Throws:
WavesetException

realCreate

protected void realCreate(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Create a new account.

Overrides:
realCreate in class ResourceAdapterBase
Throws:
WavesetException

addAttributeValue

public void addAttributeValue(java.lang.StringBuffer b,
                              WSUser user,
                              java.lang.String attname)
Helper method for building the values() list for an insert statement from account attributes. It simply checks for null values, and converts the to null keywords in the values list.


checkUpdateAccount

public WavesetResult checkUpdateAccount(WSUser user)
                                 throws WavesetException
Check the ability to perform an account update. The account must exist.

Specified by:
checkUpdateAccount in interface ResourceAdapter
Specified by:
checkUpdateAccount in class ResourceAdapterBase
Throws:
WavesetException

realUpdate

protected void realUpdate(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Perform the actual account update.

The account ID cannot be changed. The AA_USERNO attribute is system generated and cannot be changed.

Password changes are indiciated with a non-null password stored in the ResourceInfo object for this resource.

Extended account attribute changes are indicated with non-null attribute values in the user. If an attribute value is null, it means that the current value is to be kept, not cleared. To clear a value, the attribute value in the user must be the empty string.

We currently do not have a way to flag changes in the email value, other than reading the current user object and comparing.

Attribute changes will be collected in a Map which will then be used to construct a SQL update statement.

Overrides:
realUpdate in class ResourceAdapterBase
Throws:
WavesetException

checkDeleteAccount

public WavesetResult checkDeleteAccount(WSUser user)
                                 throws WavesetException
Check account deletion. We don't care if the count doesn't exist, just make sure the server is accessable.

Specified by:
checkDeleteAccount in interface ResourceAdapter
Specified by:
checkDeleteAccount in class ResourceAdapterBase
Throws:
WavesetException

realDelete

protected void realDelete(WSUser user,
                          WavesetResult result)
                   throws WavesetException
Delete the account for real.

Overrides:
realDelete in class ResourceAdapterBase
Throws:
WavesetException

getColumn

public void getColumn(java.sql.ResultSet res,
                      int column,
                      WSUser user,
                      java.lang.String attname)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

getColumn

public java.lang.String getColumn(java.sql.ResultSet result,
                                  int col)
                           throws java.sql.SQLException
Get a string from a result set, trimming trailing blanks.

Throws:
java.sql.SQLException

getUser

public WSUser getUser(WSUser user)
               throws WavesetException
Public adapter method to get the current user information.

Specified by:
getUser in interface ResourceAdapter
Overrides:
getUser in class ResourceAdapterBase
Throws:
WavesetException

buildUser

public WSUser buildUser(java.lang.String id)
Build the base user object given an id.


getAccountAttributes

public WSAttributes getAccountAttributes(java.lang.String accountIdentity)
                                  throws WavesetException
Deprecated method, use getUser instead.

Specified by:
getAccountAttributes in interface ResourceAdapter
Overrides:
getAccountAttributes in class ResourceAdapterBase
Throws:
WavesetException

getAccountIterator

public AccountIterator getAccountIterator()
                                   throws WavesetException
Return an iterator that will iterate over all the accounts on a resource.

Specified by:
getAccountIterator in interface ResourceAdapter
Overrides:
getAccountIterator in class ResourceAdapterBase
Throws:
WavesetException

authenticate

public WavesetResult authenticate(java.util.HashMap loginInfo)
                           throws WavesetException
Check to see if a user account and password is valid.

Specified by:
authenticate in interface ResourceAdapter
Specified by:
authenticate in class ResourceAdapterBase
Throws:
WavesetException

closeConnection

public void closeConnection(java.sql.Connection con)
Close a connection, quietly.


closeStatement

public void closeStatement(java.sql.PreparedStatement stmt)
Close a statement, quietly.


closeResult

public void closeResult(java.sql.ResultSet res)
Close a result, quietly.


queryInt

public int queryInt(java.sql.Connection c,
                    java.lang.String q,
                    java.lang.String arg)
             throws WavesetException
Run a query and return an expected integer in the first column of the first row.

Throws:
WavesetException

queryString

public java.lang.String queryString(java.sql.Connection c,
                                    java.lang.String q,
                                    java.lang.String arg)
                             throws WavesetException
Run a query and return an expected string in the first column of the first row.

Throws:
WavesetException