Celartem::CredentialProvider Class Reference

#include <cel_credprovider.h>

Inheritance diagram for Celartem::CredentialProvider:

Inheritance graph
[legend]

List of all members.

Public Types

enum  GetCredentialFlag

Public Member Functions

virtual AutoPtr< CredentialInfogetCredential (AuthTargetType inAuthTargetType, const String &inAuthTarget, u32 inFlags=0)=0

Static Public Member Functions

static AutoPtr
< CredentialProvider
createFromStrings (const String &inUserName, const String &inPassword, const String &inTarget=NullString)
static AutoPtr
< CredentialProvider
create (void *inParentHandle, const String &inCaption, const String &inMessage=NullString, unsigned long inFlags=0)


Detailed Description

CredentialProvider defines the interface of retrieving credential information. All PixelLive/PixelSafe functions which handle the credential information use this class. You can create your own CredentialProvider classes that bridges the your GUI/CUI codes that interacts with the users to this library. For the most easiest case, if an application already has the user name and password in plain string, use createFromStrings function to create CredentialProvider instance. For more information about CredentialProvider or authentication, see Open the Image Files that Requires Authentication.

Definition at line 103 of file cel_credprovider.h.


Member Enumeration Documentation

enum Celartem::CredentialProvider::GetCredentialFlag

Note that CredentialProvider implementation can ignore these flags and they are just advisary.

Definition at line 110 of file cel_credprovider.h.


Member Function Documentation

virtual AutoPtr<CredentialInfo> Celartem::CredentialProvider::getCredential ( AuthTargetType  inAuthTargetType,
const String inAuthTarget,
u32  inFlags = 0 
) [pure virtual]

This method returns a CredentialInfo instance that holds the credential for the specified target. The way the method actually retrieves the credential is not defined; it may show some dialog to prompt the user to input his User name and password or it may load the information from private credential store such as key-chain or something like it.

Parameters:
inAuthTargetType One of the AuthTargetType enumeration value.
inAuthTarget Human readable string that uniquely identifies the authentication target. The actual value of this parameter is defined by inAuthTargetType:
  • authHttpBasic
    The URL of the resource.
  • authHttpProxy
    The address of the proxy server; it may be dotted-decimal notation of the IP address or human readable host name.
  • authPixelSafe2Local
    The GUID of the PFZ file in String.
  • authPixelSafe2
    The address of the PixelSafe server.
  • authPixelSafe3
    This value is not used with the current implementation.
  • authUnknown
    Some unique identifier of the server or resource.
inFlags Any combination of GetCredentialFlag enumeration values.
Returns:
Pointer to the newly created CredentialInfo instance. If this method fails to obtain the credential for the specified target, it returns NULL.
See also:
CredentialInfo

static AutoPtr<CredentialProvider> Celartem::CredentialProvider::createFromStrings ( const String inUserName,
const String inPassword,
const String inTarget = NullString 
) [static]

This function creates a CredentialProvider instance from the pair of user name and password.
The CredentialProvider instance created by the function internally uses SecureString to preserve the information and it is more secure than preserving username and password in plain text.

Parameters:
inUserName The user name.
inPassword The password for the user name.
inTarget The target of this credential information.
Returns:
Pointer to the newly created CredentialProvider instance.
The following code illustrates how to use this function in your code:
                char username[256], password[256];

                // Prompt user to input the information.
                // You should check the risks of buffer overrun.
                inputDialog(username, sizeof(username), password, sizeof(password));

                AutoPtr<CredentialProvider> credProv = createFromStrings(username, password);

                // zero-clearing buffers to reduce security risks
                memset(username, sizeof(username));
                memset(password, sizeof(password));
See also:
SecureString

static AutoPtr<CredentialProvider> Celartem::CredentialProvider::create ( void *  inParentHandle,
const String inCaption,
const String inMessage = NullString,
unsigned long  inFlags = 0 
) [static]

This function creates a GUI version of CredentialProvider instance. If getCredential method is called, the instance shows some dialog that prompts the user to input his user name and password.
Currently, this function is only provided on the following platforms:

Parameters:
inParentHandle Platform dependent parent window handle. On windows, this is HWND.
inCaption The caption for the dialog.
inMessage The message for the dialog. If this is NullString, the GUI shows the inAuthTarget passed to getCredential method.
inFlags Reserved. It must be 0.
Returns:
Pointer to the newly created CredentialProvider instance.


The documentation for this class was generated from the following file:
This document is automatically generated using doxygen 1.5.4 at Fri Jun 27 18:23:15 2008.