2cc21a344c
in order to allow for the client component to be consumed by distributions targeting the desktop. This check-in is for the server project.
306 lines
10 KiB
C
306 lines
10 KiB
C
/***********************************************************************
|
|
*
|
|
* Copyright (C) 2006 Novell, Inc. All Rights Reserved.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; version 2.1
|
|
* of the License.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Library Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, Novell, Inc.
|
|
*
|
|
* To contact Novell about this file by physical or electronic mail,
|
|
* you may find current contact information at www.novell.com.
|
|
*
|
|
* Author: Juan Carlos Luciani <jluciani@novell.com>
|
|
*
|
|
***********************************************************************/
|
|
|
|
#ifndef _CASA_S_AUTHTOKEN_H_
|
|
#define _CASA_S_AUTHTOKEN_H_
|
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
//===[ Include files ]=====================================================
|
|
|
|
#include <micasa_types.h>
|
|
#include <casa_status.h>
|
|
|
|
//===[ Type definitions ]==================================================
|
|
|
|
#ifndef SSCS_CALL
|
|
#if defined(WIN32)
|
|
#define SSCS_CALL __stdcall
|
|
#else
|
|
#define SSCS_CALL
|
|
#endif
|
|
#endif
|
|
|
|
//===[ Function prototypes ]===============================================
|
|
|
|
//===[ Global variables ]==================================================
|
|
|
|
|
|
/**************************************************************************
|
|
***************************************************************************
|
|
** **
|
|
** Principal Interface Definition **
|
|
** **
|
|
***************************************************************************
|
|
**************************************************************************/
|
|
|
|
|
|
//++=======================================================================
|
|
typedef
|
|
int
|
|
(SSCS_CALL *PFNPrincipalIf_AddReference)(
|
|
IN const void *pIfInstance);
|
|
//
|
|
// Arguments:
|
|
// pIfInstance -
|
|
// Pointer to interface object.
|
|
//
|
|
// Returns:
|
|
// Interface reference count.
|
|
//
|
|
// Description:
|
|
// Increases interface reference count.
|
|
//=======================================================================--
|
|
|
|
|
|
//++=======================================================================
|
|
typedef
|
|
void
|
|
(SSCS_CALL *PFNPrincipalIf_ReleaseReference)(
|
|
IN const void *pIfInstance);
|
|
//
|
|
// Arguments:
|
|
// pIfInstance -
|
|
// Pointer to interface object.
|
|
//
|
|
// Returns:
|
|
// Nothing.
|
|
//
|
|
// Description:
|
|
// Decreases interface reference count. The interface is deallocated if
|
|
// the reference count becomes zero.
|
|
//=======================================================================--
|
|
|
|
|
|
//++=======================================================================
|
|
typedef
|
|
CasaStatus
|
|
(SSCS_CALL *PFNPrincipalIf_GetIdentityId)(
|
|
IN const void *pIfInstance,
|
|
INOUT char *pIdentIdBuf,
|
|
INOUT int *pIdentIdLen);
|
|
//
|
|
// Arguments:
|
|
// pIfInstance -
|
|
// Pointer to interface object.
|
|
//
|
|
// pIdentIdBuf -
|
|
// Pointer to buffer that will receive the identity id. The returned
|
|
// id will be in the form of a NULL terminated string.
|
|
//
|
|
// pIdentIdBufLen -
|
|
// Pointer to variable with the length of the buffer pointed by
|
|
// pIdentIdBuf. On exit it contains the length of the returned id
|
|
// (including the NULL terminator).
|
|
//
|
|
//
|
|
// Returns:
|
|
// Casa Status
|
|
//
|
|
// Description:
|
|
// Get the identity id associated with the identity token.
|
|
//=======================================================================--
|
|
|
|
|
|
//++=======================================================================
|
|
typedef
|
|
CasaStatus
|
|
(SSCS_CALL *PFNPrincipalIf_GetSourceName)(
|
|
IN const void *pIfInstance,
|
|
INOUT char *pSourceNameBuf,
|
|
INOUT int *pSourceNameLen);
|
|
//
|
|
// Arguments:
|
|
// pIfInstance -
|
|
// Pointer to interface object.
|
|
//
|
|
// pSourceNameBuf -
|
|
// Pointer to buffer that will receive the name associated with the
|
|
// identity information source. The returned name will be in the form
|
|
// of a NULL terminated string.
|
|
//
|
|
// pSourceNameBufLen -
|
|
// Pointer to variable with the length of the buffer pointed by
|
|
// pSourceNameBuf. On exit it contains the length of the returned
|
|
// name (including the NULL terminator).
|
|
//
|
|
//
|
|
// Returns:
|
|
// Casa Status
|
|
//
|
|
// Description:
|
|
// Get the name of the identity source associated with the identity token.
|
|
//=======================================================================--
|
|
|
|
|
|
//++=======================================================================
|
|
typedef
|
|
CasaStatus
|
|
(SSCS_CALL *PFNPrincipalIf_GetSourceUrl)(
|
|
IN const void *pIfInstance,
|
|
INOUT char *pSourceUrlBuf,
|
|
INOUT int *pSourceUrlLen);
|
|
//
|
|
// Arguments:
|
|
// pIfInstance -
|
|
// Pointer to interface object.
|
|
//
|
|
// pSourceUrlBuf -
|
|
// Pointer to buffer that will receive the URL associated with the
|
|
// identity information source. The returned URL will be in the form
|
|
// of a NULL terminated string.
|
|
//
|
|
// pSourceUrlBufLen -
|
|
// Pointer to variable with the length of the buffer pointed by
|
|
// pSourceUrlBuf. On exit it contains the length of the returned
|
|
// URL (including the NULL terminator).
|
|
//
|
|
//
|
|
// Returns:
|
|
// Casa Status
|
|
//
|
|
// Description:
|
|
// Get the URL to the identity source associated with the identity token.
|
|
//=======================================================================--
|
|
|
|
|
|
//++=======================================================================
|
|
typedef
|
|
CasaStatus
|
|
(SSCS_CALL *PFNPrincipalIf_AttributeEnumerate)(
|
|
IN const void *pIfInstance,
|
|
INOUT int *pEnumHandle,
|
|
INOUT char *pAttribNameBuf,
|
|
INOUT int *pAttribNameLen,
|
|
INOUT char *pAttribValueBuf,
|
|
INOUT int *pAttribValueLen);
|
|
//
|
|
// Arguments:
|
|
// pIfInstance -
|
|
// Pointer to interface object.
|
|
//
|
|
// pEnumHandle -
|
|
// Pointer to enumeration handle. Must be set to 0 to start an
|
|
// enumeration. Note the enumeration handle advances if the
|
|
// function returns success.
|
|
//
|
|
// pAttribNameBuf -
|
|
// Pointer to buffer that will receive the identity attribute name. The
|
|
// returned name will be in the form of a NULL terminated string.
|
|
//
|
|
// pAttribNameLen -
|
|
// Pointer to variable with the length of the buffer pointed by
|
|
// pAttribNameBuf. On exit it contains the length of the returned
|
|
// name (including the NULL terminator).
|
|
//
|
|
// pAttribValueBuf -
|
|
// Pointer to buffer that will receive the identity attribute value. The
|
|
// returned value will be in the form of a NULL terminated string.
|
|
//
|
|
// pAttribValueLen -
|
|
// Pointer to variable with the length of the buffer pointed by
|
|
// pAttribValueBuf. On exit it contains the length of the returned
|
|
// value (including the NULL terminator).
|
|
//
|
|
//
|
|
// Returns:
|
|
// Casa Status
|
|
//
|
|
// Description:
|
|
// Enumerates through the attributes associated with the identity token.
|
|
//=======================================================================--
|
|
|
|
|
|
//
|
|
// Principal Interface Object
|
|
//
|
|
typedef struct _PrincipalIf
|
|
{
|
|
PFNPrincipalIf_AddReference addReference;
|
|
PFNPrincipalIf_ReleaseReference releaseReference;
|
|
PFNPrincipalIf_GetIdentityId getIdentityId;
|
|
PFNPrincipalIf_GetSourceName getSourceName;
|
|
PFNPrincipalIf_GetSourceUrl getSourceUrl;
|
|
PFNPrincipalIf_AttributeEnumerate attributeEnumerate;
|
|
|
|
} PrincipalIf, *PPrincipalIf;
|
|
|
|
|
|
/**************************************************************************
|
|
***************************************************************************
|
|
** **
|
|
** Validate Authentication Token API **
|
|
** **
|
|
***************************************************************************
|
|
**************************************************************************/
|
|
|
|
|
|
//++=======================================================================
|
|
extern CasaStatus SSCS_CALL
|
|
ValidateAuthToken(
|
|
IN const char *pServiceName,
|
|
IN const char *pTokenBuf,
|
|
IN const int tokenBufLen,
|
|
INOUT PrincipalIf **ppPrincipalIf);
|
|
//
|
|
// Arguments:
|
|
// pServiceName -
|
|
// Pointer to NULL terminated string that contains the
|
|
// name of the service targeted by the token.
|
|
//
|
|
// pTokenBuf -
|
|
// Pointer to buffer that will receive the authentication
|
|
// token. The length of this buffer is specified by the
|
|
// pTokenBufLen parameter. Note that the the authentication
|
|
// token will be in the form of a NULL terminated string.
|
|
//
|
|
// tokenBufLen -
|
|
// Length of the data contained within the buffer pointed
|
|
// at by pTokenBuf.
|
|
//
|
|
// ppPrincipalIf -
|
|
// Pointer to variable that will receive a pointer to a principal
|
|
// interface with information about the authenticated entity.
|
|
// IMPORTANT NOTE: The caller is responsible for releasing the
|
|
// interface after it is done with it to avoid a resource leak.
|
|
//
|
|
// Returns:
|
|
// Casa status.
|
|
//
|
|
// Description:
|
|
// Validates authentication token.
|
|
//
|
|
//=======================================================================--
|
|
|
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
}
|
|
#endif // #if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
#endif // #ifndef _CASA_S_AUTHTOKEN_H_
|
|
|