High Performance OPC UA Server SDK  1.7.1.383
authentication

Interface for implementing an authentication backend. More...

Modules

 internal
 For more information on the internal authentication backend and usage examples see Authentication.
 

Data Structures

struct  ua_authentication_ctx
 Context with information about a user trying to activate a session for the authentiation backend. More...
 

Functions

int ua_authentication_init (uint32_t max_users)
 Initialize structures needed for managing user authentication. More...
 
void ua_authentication_clear (void)
 Clear structures needed for managing user authentication. More...
 
ua_statuscode ua_authenticate_user (struct ua_authentication_ctx *ctx, struct uasession_user_info *user)
 Authenticate a user which tries to activate a session. More...
 
int ua_authentication_load_from_file (const char *passwd_file)
 Load user authentication information from a file. More...
 

Detailed Description

Interface for implementing an authentication backend.

The functions declared here must be implemented by every authentication backend and are mainly intended for use by the SDK.

Adding and Removing users is backend specific and thus implemented in the backends like internal.

Function Documentation

◆ ua_authenticate_user()

ua_statuscode ua_authenticate_user ( struct ua_authentication_ctx ctx,
struct uasession_user_info user 
)

Authenticate a user which tries to activate a session.

In case of an error this function may synchronously return a bad statuscode, a return value of zero means this function finishes async by calling uasession_activatesession_finish with ctx as argument. It is not possible for this function to succesfully finish sync, but it may return pseudo-async by calling uasession_activatesession_finish before returning zero, in this case it must be ensured the return value is always zero.

The implementation of this function needs to use the ctx to verify the authenticity of the user and fill the required information into the user struct. The user struct is initialized and the fields token_type and policy_id are already set correctly. The result is set to a bad statuscode and must be explicitly set to zero on success. All other fields are null/empty, so the implementation must set the client_user_id and the token specific fields.

Parameters
ctxContext with information about the user trying to activate the session.
userPreallocated struct for user information.
Returns
A bad statuscode means sync finish, zero means async finish.

◆ ua_authentication_clear()

void ua_authentication_clear ( void  )

Clear structures needed for managing user authentication.

All users wil be removed and no user will be able to authenticate any longer.

◆ ua_authentication_init()

int ua_authentication_init ( uint32_t  max_users)

Initialize structures needed for managing user authentication.

Parameters
max_usersMaximum number of users, that can be added.
Returns
0 on success or errorcode on failure.

◆ ua_authentication_load_from_file()

int ua_authentication_load_from_file ( const char *  passwd_file)

Load user authentication information from a file.

Parameters
passwd_fileName of the file to load authentication information from.
Returns
0 on success or errorcode on failure.