ibi.broker.api.cci
Class SecurityTokenCredential

java.lang.Object
  extended by ibi.broker.api.cci.SecurityTokenCredential
All Implemented Interfaces:
Credential, java.io.Serializable, javax.resource.cci.ConnectionSpec

public final class SecurityTokenCredential
extends java.lang.Object
implements Credential, java.io.Serializable

 This class is used to pass the security token (the RC_Cookie or MRE_Cookie) 
 information to the CasterConnectionFactory.getConnection() method. Currently these are 
 the only two tokens supported. The following code was taken from the samples provided  
 with the API, and offers an example of using SecurityTokenCredential.

 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++      
 +  Copyright (c) 2004 Information Builders, Inc. All  Rights Reserved.     +      
 +                                                                          +      
 +  Information Builders offers sample API programs as a heuristic device.  +      
 +  They are not intended, as is, for production use. Licensed users are    +      
 +  welcome to alter and extend these samples and deploy them in other      +      
 +  environments, or alternate configurations, as they see fit.             +      
 +  Information Builders will support the documented functionality of       +      
 +  its API classes and methods. However, Information Builders is not       +      
 +  responsible for functionality or behavior of products built with        +      
 +  its API unless the documented behavior of its discrete classes and      +      
 +  methods is different than the actual results.                           +      
 +                                                                          +      
 +  Redistributions of IBI source code and documentation must be within     +      
 +  the scope of the Information Builders Software License Agreement.       +      
 +                                                                          +      
 + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   

<%@ page  import="ibi.broker.api.*"%>
<%@ page  import="ibi.broker.api.cci.*"%>
<%@ page  import="javax.resource.cci.*"%>

<%
                CasterConnection casterConnection = null;
                try
                {
                        // for cookies
                        {
                                Cookie[] cookieList = request.getCookies();
                                String securityToken = null;
                                for(int i = 0; i < cookieList.length; i++)
                                {
                                        if(cookieList[i].getName().equals("RC_COOKIE"))
                                        {
                                                securityToken = cookieList[i].getValue();
                                                break;
                                        }
                                }
                                
                                CasterManagedConnectionFactory managedConnectionFactory = new CasterManagedConnectionFactory();
                                String host = pageContext.getServletContext().getInitParameter("AGENT_NODE");
                                String port = pageContext.getServletContext().getInitParameter("AGENT_PORT");
                                managedConnectionFactory.setServerName(host);
                                managedConnectionFactory.setPortNumber(port);
                                CasterConnectionFactory connectionFactory = (CasterConnectionFactory)managedConnectionFactory.createConnectionFactory();
                                
                                ConnectionSpec credential = new SecurityTokenCredential(securityToken);
                                casterConnection = ((CasterConnection)connectionFactory.getConnection(credential));
                        }
                        //for session
                        {
                                casterConnection = (CasterConnection)request.getSession().getAttribute("CASTER_CONNECTION");
                        }
                        out.println("NextPage OK");
                        
                        ///////Continue
                }
                catch(Exception e)
                {
                        try{
                                out.println(e.getMessage());
                        }catch(Exception ex){}
                        
                }


%>

Version:
5.3
Author:
unxyxc
See Also:
Serialized Form

Constructor Summary
SecurityTokenCredential()
          Constructor of SecurityTokenCredential.
SecurityTokenCredential(java.lang.String securityToken)
          Constructor of SecurityTokenCredential.
 
Method Summary
 java.lang.String getSecurityToken()
          Return This security token string of the specified cookie type.
 java.lang.String getUserName()
          Return This security token's user name.
 void setSecurityToken(java.lang.String securityToken)
          Set a security token string in the format accepted by the token type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityTokenCredential

public SecurityTokenCredential()
Constructor of SecurityTokenCredential.


SecurityTokenCredential

public SecurityTokenCredential(java.lang.String securityToken)
Constructor of SecurityTokenCredential.

Parameters:
securityToken - String
Method Detail

getSecurityToken

public java.lang.String getSecurityToken()
Return This security token string of the specified cookie type.

Returns:
String A String representing the contents of the Security Token.

setSecurityToken

public void setSecurityToken(java.lang.String securityToken)
Set a security token string in the format accepted by the token type.

Parameters:
securityToken - A String in the format expected by the Security Token.

getUserName

public java.lang.String getUserName()
Return This security token's user name.

Specified by:
getUserName in interface Credential
Returns:
A String representing the user name.


Copyright © 2006 Information Builders, Incorporated.