My Project
SignOn::AuthSession Class Reference

Represents a session to authentication plugin/server. More...

#include <SignOn/AuthSession>

Inheritance diagram for SignOn::AuthSession:

Public Types

enum  AuthSessionError {
  UnknownError = 1 , InternalServerError = 2 , InternalCommunicationError = 3 , PermissionDeniedError = 4 ,
  AuthSessionErr = 300 , MechanismNotAvailableError , MissingDataError , InvalidCredentialsError ,
  WrongStateError , OperationNotSupportedError , NoConnectionError , NetworkError ,
  SslError , RuntimeError , CanceledError , TimedOutError ,
  UserInteractionError
}
 Codes for errors that may be reported by AuthSession objects. More...
 
enum  AuthSessionState {
  SessionNotStarted = 0 , HostResolving , ServerConnecting , DataSending ,
  ReplyWaiting , UserPending , UiRefreshing , ProcessPending ,
  SessionStarted , ProcessCanceling , ProcessDone , CustomState ,
  MaxState
}
 Codes for the states of the AuthSession object. More...
 

Signals

void error (const SignOn::Error &err)
 Emitted when an error occurs while performing an operation. More...
 
void mechanismsAvailable (const QStringList &mechanisms)
 Emitted when the list of available mechanisms have been obtained for identity. More...
 
void response (const SignOn::SessionData &sessionData)
 Authentication response generated by the authentication service. More...
 
void stateChanged (AuthSession::AuthSessionState state, const QString &message)
 Provides the information about the state of the authentication request. More...
 

Public Member Functions

const QString name () const
 Name of method for session. More...
 
void queryAvailableMechanisms (const QStringList &wantedMechanisms=QStringList())
 Query list of available mechanisms. More...
 
void process (const SessionData &sessionData, const QString &mechanism=QString())
 Processes sessionData in the authentication service. More...
 
void challenge (const SessionData &sessionData, const QString &mechanism=QString())
 Sends a challenge to the authentication service. More...
 
void request (const SessionData &sessionData, const QString &mechanism=QString())
 Sends a request to the authentication service. More...
 
void cancel ()
 Cancels the ongoing challenge. More...
 
void signMessage (const SessionData &params, const QString &mechanism=QString())
 Signs message by using secret stored into identity. More...
 

Protected Member Functions

 AuthSession (quint32 id, const QString &methodName, QObject *parent=0)
 

Detailed Description

Represents a session to authentication plugin/server.

AuthSession is used to maintain connection to authentication plugin.

Definition at line 54 of file authsession.h.

Member Enumeration Documentation

◆ AuthSessionError

Codes for errors that may be reported by AuthSession objects.

Deprecated:
This enum is deprecated.

Replaced by Error::ErrorType.

Enumerator
UnknownError 

Catch-all for errors not distinguished by another code.

InternalServerError 

Signon Daemon internal error.

InternalCommunicationError 

Communication with Signon Daemon error .

PermissionDeniedError 

The operation cannot be performed due to insufficient client permissions.

MechanismNotAvailableError 

The requested mechanism is not available.

MissingDataError 

The SessionData object does not contain necessary information.

InvalidCredentialsError 

The supplied credentials are invalid for the mechanism implementation.

WrongStateError 

An operation method has been called in a wrong state.

OperationNotSupportedError 

The operation is not supported by the mechanism implementation.

NoConnectionError 

No Network connetion.

NetworkError 

Network connetion failed.

SslError 

Ssl connetion failed.

RuntimeError 

Casting SessionData into subclass failed

CanceledError 

Challenge was canceled.

TimedOutError 

Challenge was timed out.

UserInteractionError 

User interaction dialog failed

Definition at line 69 of file authsession.h.

◆ AuthSessionState

Codes for the states of the AuthSession object.

See also
stateChanged(AuthSession::AuthSessionState state, const QString &message)
Todo:
The order of the states must be synchronized with AuthPluginState enum
Enumerator
SessionNotStarted 

No message.

HostResolving 

Resolving remote server host name.

ServerConnecting 

Connecting to remote server.

DataSending 

Sending data to remote server.

ReplyWaiting 

Waiting reply from remote server.

UserPending 

Waiting response from user.

UiRefreshing 

Refreshing ui request.

ProcessPending 

Waiting another process to start.

SessionStarted 

Authentication session is started.

ProcessCanceling 

Canceling.current process: is this really needed???

ProcessDone 

Authentication completed. >

CustomState 

Custom message.

Definition at line 95 of file authsession.h.

Constructor & Destructor Documentation

◆ AuthSession()

SignOn::AuthSession::AuthSession ( quint32  id,
const QString &  methodName,
QObject *  parent = 0 
)
protected

Definition at line 35 of file authsession.cpp.

Member Function Documentation

◆ cancel()

void SignOn::AuthSession::cancel ( )

Cancels the ongoing challenge.

Signal error() is emitted with Error::type() Error::SessionCanceled when process is canceled. If there is no challenge to cancel, Error::type() is Error::WrongState. If the operation fails, the error() signal is emitted.

See also
AuthSession::error()

Definition at line 76 of file authsession.cpp.

◆ challenge()

void SignOn::AuthSession::challenge ( const SessionData sessionData,
const QString &  mechanism = QString() 
)
inline

Sends a challenge to the authentication service.

The service processes the challenge and generates a response token that is emitted with response() signal. If the operation fails, the error() signal is emitted.

This is actually a call to process.

See also
process
AuthSession::response()
AuthSession::error()
Parameters
sessionDataInformation for authentication session
mechanismMechanism to use for authentication

Definition at line 183 of file authsession.h.

◆ error

void SignOn::AuthSession::error ( const SignOn::Error err)
signal

Emitted when an error occurs while performing an operation.

Typical error types are generic errors, where Error::type() < Error::AuthServiceErr and AuthSession specific, where Error::AuthSessionErr < Error::type() < Error::UserErr

See also
SignOn::Error
SignOn::Error::ErrorType
Parameters
errThe error object

◆ mechanismsAvailable

void SignOn::AuthSession::mechanismsAvailable ( const QStringList &  mechanisms)
signal

Emitted when the list of available mechanisms have been obtained for identity.

Parameters
mechanismsList of available mechanisms

◆ name()

const QString SignOn::AuthSession::name ( ) const

Name of method for session.

Returns
Name of authentication method.

Definition at line 60 of file authsession.cpp.

◆ process()

void SignOn::AuthSession::process ( const SessionData sessionData,
const QString &  mechanism = QString() 
)

Processes sessionData in the authentication service.

The service processes the data and generates a response that is emitted with response() signal. If the operation fails, the error() signal is emitted.

The format and interpretation of the data is mechanism-specific. The client usually obtains the data from a network protocol, such as the protocols using SASL. In case the mechanism implies generation of the authentication token without a challenge, this method should be called with an empty parameters.

Parameters are key value pairs, and they are given for authentication plugin. For example it can contain server name, realm, client key, etc. If the Identity objected that created this AuthSession object was itself created using a IdentityInfo object having the username and secret set, that data is going to be added to the params map before it is passed to a specific authentication plugin implementation. If credentials have been stored with Identity::storeCredentials, then the username is overriden from database. Stored secret is used as a default value.

See also
AuthSession::response()
AuthSession::error()
Parameters
sessionDataInformation for authentication session
mechanismMechanism to use for authentication
See also
IdentityInfo
AuthPluginInterface

Definition at line 70 of file authsession.cpp.

◆ queryAvailableMechanisms()

void SignOn::AuthSession::queryAvailableMechanisms ( const QStringList &  wantedMechanisms = QStringList())

Query list of available mechanisms.

If wantedMechanisms list is provided, only mechanisms available on that list are reported. List is returned by emitting signal mechanismsAvailable(). If the operation fails, the error() signal is emitted.

See also
AuthSession::mechanismsAvailable()
AuthSession::error()
Parameters
wantedMechanismsList of mechanisms that the client would like to use

Definition at line 65 of file authsession.cpp.

◆ request()

void SignOn::AuthSession::request ( const SessionData sessionData,
const QString &  mechanism = QString() 
)
inline

Sends a request to the authentication service.

The service processes the request and generates a response token that is emitted with response() signal. If the operation fails, the error() signal is emitted.

This is actually a call to process.

See also
process
AuthSession::response()
AuthSession::error()
Parameters
sessionDataInformation for authentication session
mechanismMechanism to use for authentication

Definition at line 201 of file authsession.h.

◆ response

void SignOn::AuthSession::response ( const SignOn::SessionData sessionData)
signal

Authentication response generated by the authentication service.

It is sent after a process() call sends a challenge token for authentication is used to request an authentication token, with the response token and accompanying non-opaque information produced by the service.

The format and interpretation of the response, as well as names and types of the information parameters, are mechanism-specific.

Parameters
sessionDataParameters with the authentication token

◆ signMessage()

void SignOn::AuthSession::signMessage ( const SessionData params,
const QString &  mechanism = QString() 
)
inline

Signs message by using secret stored into identity.

This convenience interface is to do special challenge to signature service.

Parameters
paramsExtra information for signing
mechanismMechanism to use for signing
Deprecated:

Definition at line 224 of file authsession.h.

◆ stateChanged

void SignOn::AuthSession::stateChanged ( AuthSession::AuthSessionState  state,
const QString &  message 
)
signal

Provides the information about the state of the authentication request.

Parameters
stateCurrent state of the authentication request
messageTextual description of the state

The documentation for this class was generated from the following files: