Oracle Single Sign-On Application Developer's Guide Release 3.0.6 Part Number A86782-03 |
| Library | Service | Index

# 4
Java Oracle Single Sign-On Application Programming Interface

The Java package, `oracle.security.sso,` contains information about how application developers can use Java classes and methods to enable web users to access partner applications by means of Oracle Single Sign-On. This chapter should be used as a reference and assumes that the reader is familiar with PL/SQL functions and procedures for using Oracle Single Sign-On.

This chapter contains these topics:

- Package

  - ``SSOEnabler``

  - ``SSOEnablerConfig``

  - ``SSOEnablerConfigMgr``

  - ``SSOEnablerException``

  - ``SSOEnablerUtil``

  - ``SSOUserInfo``

    See Also: Chapter 3, "PL/SQL Single Sign-On Application Programming Interface"

## Package

##### oracle.security.sso.enabler

##### Description

Table 4-1 oracle.security.sso.enabler

Class Summary |
--- | ---
Classes |
SSOEnabler | This class implements the enabler stack of the Oracle Single Sign-On service for partner application development.
SSOEnablerConfig | This class is used with`SSOEnabler` class for configuration parameters setup
SSOEnablerConfigMgr | This class implements the enabler stack of the Oracle Single Sign-On service for partner application development.
SSOEnablerUtil |
SSOUserInfo | This class is used for returning user information after parsing the redirect URL from `SSOEnabler` class.
Exceptions |
SSOEnablerException | This class is subclass of`java.lang.Exception`.

## oracle.security.sso.enabler

### SSOEnabler

##### Syntax

    public class SSOEnabler extends java.lang.Object

    java.lang.Object
      |
      +--oracle.security.sso.enabler.SSOEnabler

##### Description

This class implements the enabler stack of the Oracle Single Sign-On service for partner application development.

##### Since:

1.0

##### See Also:

``SSOUserInfo``

Table 4-2 SSOEnabler Member Summary

Member Summary |
--- | ---
Constructors |
SSOEnabler | Creates an Oracle Single Sign-On enabler object, with no database connection.
SSOEnabler(Connection) | Creates an Oracle Single Sign-On enabler object, with database connection.
Methods |
generateRedirect(String, String, String) | Generates a redirect URL from requested URL and cancel URL.
getSSOUserInfo(String, String, InetAddress) | Parses a redirect URL from Oracle Single Sign-On server which contains user information.
setDbConnection(Connection) | Initializes Oracle Single Sign-On enabler object, with a database connection.

Table 4-3 SSOEnabler Inherited Member Summary

Inherited Member Summary
Methods inherited from `class java.lang.Objec`t
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructors

### SSOEnabler()

    public  SSOEnabler()

Creates an Oracle Single Sign-On enabler object, with no database connection.

### SSOEnabler(Connection)

    public  SSOEnabler(java.sql.Connection p_db_conn)

Creates an Oracle Single Sign-On enabler object, witha database connection.

##### See Also:

`java.sql.Connection`

## Methods

### generateRedirect(String, String, String)

    public java.lang.String generateRedirect(java.lang.String p_listenerToken,
    java.lang.String p_requestedUrl, java.lang.String p_onCancelUrl)

Generates a redirect URL from the requested URL and the cancel URL. When a partner application wants to authenticate a user, it redirects the user (browser) to the Oracle Single Sign-On server with this URL. The requested URL string is the URL which the user wants to access. The cancel URL string is the URL to which the Oracle Single Sign-On server redirects the user when the user does not wish to authenticate at that moment.

##### Returns:

Redirect url

##### Throws:

``SSOEnablerException``--whenthere is an error in constructing redirect url

### getSSOUserInfo(String, String, InetAddress)

    public SSOUserInfo getSSOUserInfo(java.lang.String p_listenerToken,
    java.lang.String p_cookieStr, java.net.InetAddress p_clientIp)

Parses a redirect URL from the Oracle Single Sign-On server which contains user information.

##### Returns:

`SSOUserInfo` object which contains user information

##### Throws:

``SSOEnablerException``--whenthere is an error in parsing

##### See Also:

``SSOUserInfo``

### setDbConnection(Connection)

    public void setDbConnection(java.sql.Connection p_db_conn)

Initializes the Oracle Single Sign-On enabler object with a database connection.

##### Throws:

``SSOEnablerException``--when the database connection is lost

##### See Also:

`java.sql.Connection`

## oracle.security.sso.enabler

### SSOEnablerConfig

##### Syntax

    public class SSOEnablerConfig extends java.lang.Object

    java.lang.Object
      |
      +--oracle.security.sso.enabler.SSOEnablerConfig

##### Description

This class is used with SSOEnabler class for configuration parameters setup.

##### Since:

1.0

##### See Also:

``SSOEnabler``

Table 4-4 SSOEnablerConfig Member Summary

Member Summary |
--- | ---
Constructors |
SSOEnablerConfig() | Sets none of the properties.
SSOEnablerConfig(String, String, String, String, String, String, String, String, String) | Sets all of the properties.
Methods |
getEncryptionKey() | Returns the encryption key.
getEncryptionMaskPost() | Returns the encryption mask post.
getEncryptionMaskPre() | Returns the encryption mask pre.
getListnerToken() | Returns the listener token.
getLoginUrl() | Returns the login URL.
getSiteID() | Returns the site identifier.
getSiteToken() | Returns the site token.
getUrlCookieIPCheck() | Returns the URL cookie IP check.
getUrlCookieVersion() | Returns the URL cookie version.
setEncryptionKey(String) | Sets the encryption key.
setEncryptionMaskPost(String) | Sets the encryption mask post.
setEncryptionMaskPre(String) | Sets the encryption mask pre.
setListnerToken(String) | Sets the listener token.
setLoginUrl(String) | Sets the login URL.
setSiteID(String) | Sets the site identifier.
setSiteToken(String) | Sets the site token.
setUrlCookieIPCheck(String) | Sets the URL cookie IP check.
setUrlCookieVersion(String) | Sets the URL cookie version.

Table 4-5 SSOEnablerConfig Inherited Member Summary

Inherited Member Summary
Methods inherited from `class java.lang.Object`
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructors

### SSOEnablerConfig()

    public  SSOEnablerConfig()

Sets no properties.

### SSOEnablerConfig(String, String, String, String, String, String, String, String, String)

    public  SSOEnablerConfig(java.lang.String p_listenerToken, java.lang.String p_
    siteToken, java.lang.String p_siteID, java.lang.String p_loginURL,
    java.lang.String p_urlCookieVersion, java.lang.String p_encryptionKey,
    java.lang.String p_encryptionMaskPre, java.lang.String p_encryptionMaskPost,
    java.lang.String p_urlCookieIPCheck)

Sets all properties.

## Methods

### getEncryptionKey()

    public java.lang.String getEncryptionKey()

Returns the encryption key.

##### Returns:

The encryption key.

### getEncryptionMaskPost()

    public java.lang.String getEncryptionMaskPost()

Returns the encryption mask post.

##### Returns:

The encryption mask post.

### getEncryptionMaskPre()

    public java.lang.String getEncryptionMaskPre()

Returns the encryption mask pre.

##### Returns:

The encryption mask pre.

### getListnerToken()

    public java.lang.String getListnerToken()

Returns the listener token.

##### Returns:

The listener token.

### getLoginUrl()

    public java.lang.String getLoginUrl()

Returns the login URL.

##### Returns:

The login URL.

### getSiteID()

    public java.lang.String getSiteID()

Returns the site identifier.

##### Returns:

The site identifier.

### getSiteToken()

    public java.lang.String getSiteToken()

Returns the site token.

##### Returns:

The site token.

### getUrlCookieIPCheck()

    public java.lang.String getUrlCookieIPCheck()

Returns the URL cookie IP check.

##### Returns:

The URL cookie IP check.

### getUrlCookieVersion()

    public java.lang.String getUrlCookieVersion()

Returns the URL cookie version.

##### Returns:

The URL cookie version.

### setEncryptionKey(String)

    public void setEncryptionKey(java.lang.String p_encryptionKey)

Sets the encryption key.

##### Parameter:

`encryptionKey`--The encryption key.

### setEncryptionMaskPost(String)

    public void setEncryptionMaskPost(java.lang.String p_encryptionMaskPost)

Sets the encryption mask post.

##### Parameter:

`encryptionMaskPost`--The encryption mask post.

### setEncryptionMaskPre(String)

    public void setEncryptionMaskPre(java.lang.String p_encryptionMaskPre)

Sets the encryption mask pre.

##### Parameter:

`encryptionMaskPre`--The encryption mask pre.

### setListnerToken(String)

    public void setListnerToken(java.lang.String p_listnerToken)

Sets the listener token.

##### Parameter:

`listnerToken`--The listener token.

### setLoginUrl(String)

    public void setLoginUrl(java.lang.String p_loginURL)

Sets the login URL.

##### Parameter:

`loginURL`--The login URL

### setSiteID(String)

    public void setSiteID(java.lang.String p_siteID)

Sets the site identifier.

##### Parameter:

`siteID`--The site identifier

### setSiteToken(String)

    public void setSiteToken(java.lang.String p_siteToken)

Sets the site token.

##### Parameters

`siteToken`--The site token

### setUrlCookieIPCheck(String)

    public void setUrlCookieIPCheck(java.lang.String p_urlCookieIPCheck)

Sets the URL cookie IP check.

##### Parameter:

`urlCookieIPCheck`--The URL cookie IP check

### setUrlCookieVersion(String)

    public void setUrlCookieVersion(java.lang.String p_urlCookieVersion)

Sets the URL cookie version.

##### Parameter:

`urlCookieVersion`--The URL cookie version

## oracle.security.sso.enabler

## SSOEnablerConfigMgr

##### Syntax

    public class SSOEnablerConfigMgr extends java.lang.Object

    java.lang.Object
      |
      +--oracle.security.sso.enabler.SSOEnablerConfigMgr

##### Description

Implements the enabler stack of the Oracle Single Sign-On service for partner application development.

##### Since:

1.0

##### See Also:

``SSOEnablerConfig``

Table 4-6 SSOEnablerConfigMgr Member Summary

Member Summary |
--- | ---
Constructors |
SSOEnablerConfigMgr() | Creates an Oracle Single Sign-On enabler object, with no database connection.
SSOEnablerConfigMgr(Connection) | Creates an Oracle Single Sign-On enabler object, with database connection.
Methods |
createEnablerConfig(SSOEnablerConfig) | Creates configuration parameters of the SSO enabler specified by the listener token.
deleteEnablerConfig(String) | Deletes the configuration parameters of the SSO enabler specified by the listener token.
getEnablerConfig(String) | Returns the configuration parameters of the SSO enabler specified by the listener token.
setDbConnection(Connection) | Initializes Oracle Single Sign-On enabler object, with a database connection.
setEnablerConfig(String, SSOEnablerConfig) | Updates the configuration parameters of the SSO enabler specified by the listener token.

Table 4-7 SSOEnablerConfigMgr Inheirited Member Summary

Inherited Member Summary
Methods inherited from `class java.lang.Object`
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructors

### SSOEnablerConfigMgr()

    public  SSOEnablerConfigMgr()

Creates an Oracle Single Sign-On enabler object, with no database connection.

### SSOEnablerConfigMgr(Connection)

    public  SSOEnablerConfigMgr(java.sql.Connection p_db_conn)

Creates an Oracle Single Sign-On enabler object, with database connection.

##### See Also:

`java.sql.Connection`

## Methods

### createEnablerConfig(SSOEnablerConfig)

    public void createEnablerConfig(SSOEnablerConfig p_configuration)

Creates configuration parameters of the SSO enabler specified by the listener token.

##### Parameter:

`p_configuration`--The configuration for the SSO enabler to be added. All the members of this class must be filled in except for `encryptionMaskPre` and `encryptionMaskPost`, which must be empty strings ("").

##### Throws:

SSOEnablerException--Raised when the database connection is lost, the database is not configured properly, or invalid data is passed into this procedure.

##### See Also:

SSOEnablerConfig

### deleteEnablerConfig(String)

    public void deleteEnablerConfig(java.lang.String p_listenerToken)

Deletes the configuration parameters of the SSO enabler specified by the listener token.

##### Parameter:

`p_listenerToken`--The listener token of the SSO enabler `p_configuration` that is to be deleted

##### Throws:

SSOEnablerException--Raised when the database connection is lost, the database is not configured properly, or invalid data is passed into this procedure.

### getEnablerConfig(String)

    public SSOEnablerConfig getEnablerConfig(java.lang.String p_listenerToken)

Returns the configuration parameters of the SSO enabler specified by the listener token.

##### Parameter:

`p_listenerToken`--The listener token of the SSO enabler `p_configuration` that is to be selected

##### Returns:

An instance of SSOEnablerConfig containing the `p_configuration` of the SSO enabler specified by the listener token

##### Throws:

SSOEnablerException--Raised when the database connection is lost, the database is not configured properly, or the listener token is invalid.

##### See Also:

SSOEnablerConfig

### setDbConnection(Connection)

    public void setDbConnection(java.sql.Connection p_db_conn)

Initializes the Oracle Single Sign-On enabler object, with a database connection.

##### Throws:

SSOEnablerException--whenthe database connection lost

##### See Also:

`java.sql.Connection`

### setEnablerConfig(String, SSOEnablerConfig)

    public void setEnablerConfig(java.lang.String p_listenerToken,
    SSOEnablerConfig p_configuration)

Updates the configuration parameters of the SSO enabler specified by the listener token.

##### Parameter:

`p_listenerToken`--The listener token of the SSO enabler `p_configuration` that is to be updated

`p_configuration`--The configuration for the SSO enabler to be updated. (All the members of this class must be filled in.)

##### Throws:

SSOEnablerException--Raised when the database connection is lost, the database is not configured properly, or invalid data is passed into this procedure.

##### See Also:

SSOEnablerConfig

## oracle.security.sso.enabler

### SSOEnablerException

##### Syntax

    public class SSOEnablerException extends java.lang.Exception

    java.lang.Object
      |
      +--java.lang.Throwable
            |
            +--java.lang.Exception
                  |
                  +--oracle.security.sso.enabler.SSOEnablerException

##### All Implemented Interfaces:

    java.io.Serializable

##### Description

This class is a subclass of java.lang.Exception

##### Since:

1.0

Table 4-8 SSOEnablerException Member Summary

Member Summary |
--- | ---
Constructors |
SSOEnablerException() | Constructs an `SSOEnablerException` object with no specified detail message.
SSOEnablerException(String) | Constructs an `SSOEnablerException` object with specified detail message.

Table 4-9 SSOEnablerException Inheirited Member Summary

Inherited Member Summary
Methods inherited from `class java.lang.Throwable`
`fillInStackTrace, getLocalizedMessage, getMessage, printStackTrace, printStackTrace, printStackTrace, toString`
Methods inherited from `class java.lang.Object`
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructors

### SSOEnablerException()

    public  SSOEnablerException()

Constructs an `SSOEnablerException` object with no specified detail message.

### SSOEnablerException(String)

    public  SSOEnablerException(java.lang.String p_str)

Constructs an `SSOEnablerException` object with specified detail message.

## oracle.security.sso.enabler

### SSOEnablerUtil

##### Syntax

    public class SSOEnablerUtil extends java.lang.Object

    java.lang.Object
      |
      +--oracle.security.sso.enabler.SSOEnablerUtil

##### Description

Table 4-10 SSOEnablerUtil Member Summary

Member Summary |
--- | ---
Constructors |
SSOEnablerUtil() | Creates a utility object for application cookie baking/unbaking, with no database connection.
SSOEnablerUtil(Connection) | Creates a utility object for application cookie baking/unbaking, with database connection.
Methods |
bakeAppCookie(String, String) | Bakes the input application cookie for encryption and hashing The return string is encrypted along with hashed application cookie.
genHtmlPostForm(String) | Generates a HTML post form to the login server URL from generate redirect url.
genRedirect(String) | Generate a HTML redirect to the specified url.
setDbConnection(Connection) | Initializes utility object for application cookie baking/unbaking, with a database connection.
unbakeAppCookie(String, String) | Unbakes the input baked application cookie. The return string is the decrypted application cookie.

Table 4-11 SSOEnablerUtil Inheirited Member Summary

Inherited Member Summary
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

## Constructors

### SSOEnablerUtil()

    public  SSOEnablerUtil()

Creates a utility object for application cookie baking/unbaking, with no database connection.

### SSOEnablerUtil(Connection)

    public  SSOEnablerUtil(java.sql.Connection p_db_conn)

Creates a utility object for application cookie baking/unbaking, with a database connection.

##### See Also:

`java.sql.Connection`

## Methods

### bakeAppCookie(String, String)

    public java.lang.String bakeAppCookie(java.lang.String p_listenerToken,
    java.lang.String p_appCookie)

Bakes the input application cookie for encryption and hashing. The return string is encrypted along with the hashed application cookie.

##### Parameters:

`p_listenerToken`--Listener token for the specific login server

p_appCookie--Application cookie

##### Returns:

Baked application cookie

##### Throws:

SSOEnablerException--whenthe database connection is lost or any other error occurs

### genHtmlPostForm(String)

    public static java.lang.String genHtmlPostForm(java.lang.String p_
    genRedirectUrl)

Generates a HTML post form to the login server URL from the generate redirect url.

##### Parameter:

`p_genRedirectUrl`--generate redirect URL

##### Returns:

html redirect url

##### Throws:

`IllegalArgumentException`--whenthe input URL is incorrect

### genRedirect(String)

    public static java.lang.String genRedirect(java.lang.String p_redirectUrl)

Generates a HTML redirect to the specified url.

##### Parameter:

`p_redirectUrl`--generate redirect url

##### Returns:

html post form for login server

##### Throws:

`IllegalArgumentException`--whenthe input URL is incorrect

### setDbConnection(Connection)

    public void setDbConnection(java.sql.Connection p_db_conn)

Initializes utility object for application cookie baking/unbaking, with a database connection.

##### Throws:

SSOEnablerException--whenthe database connection is lost

##### See Also:

`java.sql.Connection`

### unbakeAppCookie(String, String)

    public java.lang.String unbakeAppCookie(java.lang.String p_listenerToken,
    java.lang.String p_bakedAppCookie)

Unbakes the input baked application cookie. The return string is the decrypted application cookie.

##### Parameter:

`p_listenerToken`--Listener token for the specific login server

`p_bakedAppCookie`--Unbaked application cookie

##### Returns:

Unbaked application cookie

##### Throws:

SSOEnablerException--whenthe database connection is lost or any other error occurs

## oracle.security.sso.enabler

### SSOUserInfo

##### Syntax

    public class SSOUserInfo extends java.lang.Object

    java.lang.Object
      |
      +--oracle.security.sso.enabler.SSOUserInfo

##### Description

Returns user information after parsing redirect URL from `SSOEnabler` class.

##### Since:

1.0

##### See Also:

``SSOEnabler``

Table 4-12 SSOUserInfo Member Summary

Member Summary |
--- | ---
Methods |
getIPAddress() | Returns IP Address.
getSiteTimeStamp() | Returns the site time stamp.
getSSOTimeRemaining() | Returns remaining Single Sign-On time in hours.
getSSOUserName() | Returns Single Sign-On user name.
getUrlRequested() | Returns URL requested by the user.

Table 4-13 SSOUserInfo InheiritedMember Summary

Inherited Member Summary
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

## Methods

### getIPAddress()

    public java.lang.String getIPAddress()

Returns the IP Address.

### getSiteTimeStamp()

    public java.sql.Date getSiteTimeStamp()

Returns the site time stamp.

### getSSOTimeRemaining()

    public int getSSOTimeRemaining()

Returns remaining Single Sign-On time in hours.

### getSSOUserName()

    public java.lang.String getSSOUserName()

Returns Single Sign-On user name.

### getUrlRequested()

    public java.lang.String getUrlRequested()

Returns URL requested by the user.

| Copyright © 1996-2000 Oracle Corporation. All Rights Reserved. |
| Library | Service | Index