My Project: SignOn::Identity Class Reference

My Project

Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
SignOn::Identity Class Reference

Represents a database entry for a single identity. More...

`#include <SignOn/Identity>`

Inheritance diagram for SignOn::Identity:
[legend]

## Public Types
enum | IdentityError { UnknownError = 1 , InternalServerError = 2 , InternalCommunicationError = 3 , PermissionDeniedError = 4 , IdentityErr = 200 , MethodNotAvailableError , NotFoundError , StoreFailedError , RemoveFailedError , SignOutFailedError , CanceledError , CredentialsNotAvailableError }
| Codes for errors that may be reported by Identity objects. More...

## Signals
void | error (const SignOn::Error &err)
| Emitted when an error occurs while performing an operation.
void | methodsAvailable (const QStringList &methods)
| Emitted when the list of available mechanisms has been obtained for identity.
void | credentialsStored (const quint32 id)
| Emitted when credentials passed by storeCredentials() method have been successfully stored on the service.
void | referenceAdded ()
| Emitted when references are added by addReference() method and change has been successfully stored on the service.
void | referenceRemoved ()
| Emitted when references are removed by removeReference() method and change has been successfully stored on the service.
void | info (const SignOn::IdentityInfo &info)
| Emitted when credentials passed by queryInfo() method.
void | userVerified (const bool valid)
| Emitted when the user verification is completed.
void | secretVerified (const bool valid)
| Emitted when secret verification is completed.
void | signedOut ()
| Emitted when the identity is signed out.
void | removed ()
| Emitted when the identity is removed.

## Public Member Functions
virtual | ~Identity ()
| Destructor.
quint32 | id () const
| Unique id of given identity.
void | queryAvailableMethods ()
| Query list of available authentication methods for given identity.
AuthSessionP | createSession (const QString &methodName)
| Creates a new session for authentication.
void | destroySession (const AuthSessionP &session)
| Destroys an authentication session.
void | requestCredentialsUpdate (const QString &message=QString())
| Requests the user to give a new secret into database.
void | storeCredentials (const IdentityInfo &info=IdentityInfo())
| Stores credential parameters for this authentication identity.
void | remove ()
| Removes this identity from database.
void | addReference (const QString &reference=QString())
| Adds the named reference to identity into the database.
void | removeReference (const QString &reference=QString())
| Removes a named reference to identity from the database.
void | queryInfo ()
| Query stored credential parameters for this authentication identity.
void | verifyUser (const QString &message=QString())
| Gets a secret verification from the user and compares it to the stored secret.
void | verifyUser (const QVariantMap &params)
| Gets a secret verification from the user and compares it to the stored secret.
void | verifySecret (const QString &secret)
| Verifies if the given secret match the stored secret.
void | signOut ()
| Signs out Identity from all services.

## Static Public Member Functions
static Identity * | newIdentity (const IdentityInfo &info=IdentityInfo(), QObject *parent=0)
| Constructs a new identity object.
static Identity * | existingIdentity (const quint32 id, QObject *parent=0)
| Constructs an identity object associated with an existing identity record.

## Protected Member Functions
| Identity (const quint32 id=SSO_NEW_IDENTITY, QObject *parent=0)

## Detailed Description

Represents a database entry for a single identity.

Identity is a client side presentation of a credential.

Definition at line 57 of file identity.h.

## Member Enumeration Documentation

## ◆ IdentityError

enum SignOn::Identity::IdentityError

Codes for errors that may be reported by Identity 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.
MethodNotAvailableError | The requested mechanism is not available.
NotFoundError | The identity matching this Identity object was not found on the service.
StoreFailedError | Storing credentials failed.
RemoveFailedError | Removing credentials failed.
SignOutFailedError | SignOut failed.
CanceledError | Operation was canceled by user.
CredentialsNotAvailableError | Query fails

Definition at line 70 of file identity.h.

## Constructor & Destructor Documentation

## ◆ Identity()

SignOn::Identity::Identity | ( | const quint32 | id = SSO_NEW_IDENTITY,
|  | QObject * | parent = 0 )
| protected

Definition at line 34 of file identity.cpp.

Referenced by existingIdentity(), and newIdentity().

## ◆ ~Identity()

SignOn::Identity::~Identity | ( |  | ) |
| virtual

Destructor.

Definition at line 64 of file identity.cpp.

## Member Function Documentation

## ◆ addReference()

void SignOn::Identity::addReference | ( | const QString & | reference = QString() | ) |

Adds the named reference to identity into the database.

On success, a signal referenceAdded() is emitted If the operation fails, a signal error() is emitted. If referencing fails, Error::type() is Error::StoreFailed,

Untrusted clients may be blocked from performing this operation, subject to the security framework restrictions.

See also
  referenceAdded()
  Identity::error()

Definition at line 109 of file identity.cpp.

## ◆ createSession()

AuthSessionP SignOn::Identity::createSession | ( | const QString & | methodName | ) |

Creates a new session for authentication.

This creates a connection to authentication plugin. The Identity object is parent and owner of all created authentication sessions.

Parameters

  methodName | Name of authentication method to use

Returns
  New authentication session or NULL if not able to create

Definition at line 78 of file identity.cpp.

## ◆ credentialsStored

void SignOn::Identity::credentialsStored | ( | const quint32 | id | ) |
| signal

Emitted when credentials passed by storeCredentials() method have been successfully stored on the service.

Parameters

  id | Identifier of the credentials that has been stored

## ◆ destroySession()

void SignOn::Identity::destroySession | ( | const AuthSessionP & | session | ) |

Destroys an authentication session.

Parameters

  session | Session to be destroyed

Definition at line 86 of file identity.cpp.

## ◆ error

void SignOn::Identity::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 Identity specific, where Error::IdentityErr < Error::type() < Error::AuthServiceErr

See also
  SignOn::Error.
  SignOn::Error::ErrorType

Parameters

  err | The error object.

## ◆ existingIdentity()

Identity * SignOn::Identity::existingIdentity | ( | const quint32 | id,
|  | QObject * | parent = 0 )
| static

Constructs an identity object associated with an existing identity record.

Can return NULL if client is untrusted.

Parameters

  id | Identity ID on the service
  parent | Parent object of the identity

Returns
  Pointer to identity object or NULL if it fails to create.

Definition at line 57 of file identity.cpp.

References Identity().

## ◆ id()

quint32 SignOn::Identity::id | ( |  | ) | const

Unique id of given identity.

Returns
  Identity ID of the identity. For new identity which is not stored, NEW_IDENTITY is returned.

Definition at line 68 of file identity.cpp.

## ◆ info

void SignOn::Identity::info | ( | const SignOn::IdentityInfo & | info | ) |
| signal

Emitted when credentials passed by queryInfo() method.

Parameters

  info | Credentials as have been stored on the service

Referenced by newIdentity(), and storeCredentials().

## ◆ methodsAvailable

void SignOn::Identity::methodsAvailable | ( | const QStringList & | methods | ) |
| signal

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

Parameters

  methods | List of available methods

## ◆ newIdentity()

Identity * SignOn::Identity::newIdentity | ( | const IdentityInfo & | info = IdentityInfo(),
|  | QObject * | parent = 0 )
| static

Constructs a new identity object.

Can return NULL if client is untrusted.

Parameters

  info | Identity information
  parent | Parent object of the identity

Returns
  Pointer to new identity object or NULL if it fails to create.

Definition at line 50 of file identity.cpp.

References Identity(), and info().

## ◆ queryAvailableMethods()

void SignOn::Identity::queryAvailableMethods | ( |  | ) |

Query list of available authentication methods for given identity.

List is returned by emitting signal methodsAvailable(). If the operation fails, a signal error() is emitted.

See also
  Identity::error() If identity is not stored, Error::type() is Error::CredentialsNotAvailable, or Error::IdentityNotFound.
  methodsAvailable().

Definition at line 73 of file identity.cpp.

## ◆ queryInfo()

void SignOn::Identity::queryInfo | ( |  | ) |

Query stored credential parameters for this authentication identity.

On success, a signal info() is emitted with parameters in the service. If the operation fails, a signal error() is emitted. If query fails, Error::type() is Error::CredentialsNotAvailable,

Untrusted clients may be blocked from performing this operation, subject to the security framework restrictions.

See also
  info()
  Identity::error()

Definition at line 119 of file identity.cpp.

## ◆ remove()

void SignOn::Identity::remove | ( |  | ) |

Removes this identity from database.

On success, a signal removed() is emitted If the operation fails, a signal error() is emitted. If removing fails, Error::type() is Error::RemoveFailed,

Untrusted clients may be blocked from performing this operation, subject to the security framework restrictions.

See also
  removed()
  Identity::error()

Definition at line 104 of file identity.cpp.

## ◆ removeReference()

void SignOn::Identity::removeReference | ( | const QString & | reference = QString() | ) |

Removes a named reference to identity from the database.

On success, a signal referenceRemoved() is emitted If the operation fails, a signal error() is emitted. If dereferencing fails, Error::type() is Error::ReferenceNotFound,

Untrusted clients may be blocked from performing this operation, subject to the security framework restrictions.

See also
  referenceRemoved()
  Identity::error()

Definition at line 114 of file identity.cpp.

## ◆ requestCredentialsUpdate()

void SignOn::Identity::requestCredentialsUpdate | ( | const QString & | message = QString() | ) |

Requests the user to give a new secret into database.

Client can use requestCredentialsUpdate() to launch external dialog for asking new secret, that will be stored into database. On success, a signal credentialsStored() is emitted. If the operation fails, a signal error() is emitted. If storing changes fails, Error::type() is Error::StoreFailed, If user cancels dialog, Error::type() is Error::IdentityOperationCanceled.

See also
  credentialsStored()
  Identity::error()

Parameters

  message | Message to be shown for the user

Definition at line 94 of file identity.cpp.

## ◆ secretVerified

void SignOn::Identity::secretVerified | ( | const bool | valid | ) |
| signal

Emitted when secret verification is completed.

Parameters

  valid | Is the given secret same as stored

## ◆ signOut()

void SignOn::Identity::signOut | ( |  | ) |

Signs out Identity from all services.

All authentication sessions using this Identity will be invalidated and all tokens cleared from cache. When sign out is completed, signal signedOut() is emitted. If the operation fails, a signal error() is emitted. If signout fails, Error::type() is Error::SignOutFailed.

All clients using same identity will receive signedOut signal.

See also
  signedOut()
  Identity::error()

Definition at line 139 of file identity.cpp.

## ◆ storeCredentials()

void SignOn::Identity::storeCredentials | ( | const IdentityInfo & | info = IdentityInfo() | ) |

Stores credential parameters for this authentication identity.

IdentityInfo contains restrictions on methods and mechanisms for given Identity.

See also
  IdentityInfo On success, a signal credentialsStored() is emitted. If the operation fails, a signal error() is emitted. If storing changes fails, Error::type() is Error::StoreFailed,

Untrusted clients may be blocked from performing this operation, subject to the security framework restrictions.

If default value is used for the parameter the Identity object stores the internally stored information, e.g. the IdentityInfo object used to create a new identity using Identity::newIdentity()

See also
  credentialsStored()
  Identity::error()

Parameters

  info | Credentials to store

Definition at line 99 of file identity.cpp.

References info().

## ◆ userVerified

void SignOn::Identity::userVerified | ( | const bool | valid | ) |
| signal

Emitted when the user verification is completed.

Parameters

  valid | Is the given secret same as stored

## ◆ verifySecret()

void SignOn::Identity::verifySecret | ( | const QString & | secret | ) |

Verifies if the given secret match the stored secret.

When verification is completed, a signal secretVerified() is emitted. If the operation fails, a signal error() is emitted. If the credentials are not stored, Error::type() is Error::CredentialsNotAvailable.

See also
  secretVerified()
  Identity::error()

Parameters

  secret | String to be verified

Definition at line 134 of file identity.cpp.

## ◆ verifyUser() [1/2]

void SignOn::Identity::verifyUser | ( | const QString & | message = QString() | ) |

Gets a secret verification from the user and compares it to the stored secret.

This launchs an external dialog for asking secret. When verification is completed, signal userVerified() is emitted. If the operation fails, a signal error() is emitted. If user selects "Forgot Password"-sequence, Error::type() is Error::ForgotPassword.

See also
  userVerified()
  Identity::error()

Parameters

  message | Message to be shown for the user

Definition at line 124 of file identity.cpp.

## ◆ verifyUser() [2/2]

void SignOn::Identity::verifyUser | ( | const QVariantMap & | params | ) |

Gets a secret verification from the user and compares it to the stored secret.

This launchs an external dialog for asking secret. When verification is completed, signal userVerified() is emitted. If the operation fails, a signal error() is emitted. If user selects "Forgot Password"-sequence, Error::type() is Error::ForgotPassword.

See also
  userVerified()
  Identity::error()

Parameters

  params | Dialog customization parameters

Definition at line 129 of file identity.cpp.

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

- identity.h
- identity.cpp