Show TOC Start of Content Area

Procedure documentation Creating an Authentication Manager  Locate the document in its SAP Library structure

An authentication manager supplies the user name and password, as well as any other parameters, for authentication during HTTP requests to the content provider.

Note

An authentication manager is for HTTP connectivity only.

The content provider service creates an instance of the authentication manager, and supplies it to each entity. During initialization of a HTTP connection, the entity creates an IURLFetcherPropertiesobject and passes it to its authentication manager, which loads the IURLFetcherPropertiesobject with the authentication parameters. The entity later provides the parameters to the HTTP connectivity service.

Procedure

...

       1.      Create a class that implements IHTTPAuthenticationManager.

       2.      Implement the addAuthenticationProperties() method. In this method, supply parameter key-value pairs to the IURLFetcherProperties object passed into the method, as in the following example:

public class myAuthenticationManager implements IHTTPAuthenticationManager

{

   private String mm_password;

   private String mm_userName;

    

   public myAuthenticationManager(IServiceContext m_context)

   {

        super();

        mm_userName = m_context.getServiceProfile().getProperty(
            myContentProviderService.IConstants.USER_NAME);

        mm_password = m_context.getServiceProfile().getProperty(
            myProviderService.IConstants.PASSWORD);
               

   }

   

   public void addAuthenticationProperties(IURLFetcherProperties properties)
        throws ContentProviderException

   {

        try

        {

            properties.getParameters().addParameter("id",mm_userName);

            properties.getParameters().addParameter("password",mm_password);

        }

        catch (InvalidParameterException e)

        {

            throw new ContentProviderException(
                
"Unable to set authentication parameters",e);

        }    

   }       

}

In the example above, the authentication manager’s constructor retrieves the user name and password from property values set for the content provider service in portalapp.xml. Note that the IServiceContext passed into the constructor is that for the provider service.

If necessary, add property elements in portalapp.xml to store the user name and password.

End of Content Area