KIO::AuthInfo

Search for usage in LXR

#include <KIO/AuthInfo>

Public Types

enum  FieldFlags { ExtraFieldNoFlags = 0 , ExtraFieldReadOnly = 1 << 1 , ExtraFieldMandatory = 1 << 2 }
 

Public Member Functions

 AuthInfo ()
 
 AuthInfo (const AuthInfo &info)
 
 ~AuthInfo ()
 
QVariant getExtraField (const QString &fieldName) const
 
AuthInfo::FieldFlags getExtraFieldFlags (const QString &fieldName) const
 
bool isModified () const
 
AuthInfooperator= (const AuthInfo &info)
 
void setExtraField (const QString &fieldName, const QVariant &value)
 
void setExtraFieldFlags (const QString &fieldName, const FieldFlags flags)
 
void setModified (bool flag)
 

Static Public Member Functions

static void registerMetaTypes ()
 

Public Attributes

QString caption
 
QString comment
 
QString commentLabel
 
QString digestInfo
 
bool keepPassword
 
QString password
 
QString prompt
 
bool readOnly
 
QString realmValue
 
QUrl url
 
QString username
 
bool verifyPath
 

Protected Attributes

bool modified
 

Detailed Description

This class is intended to make it easier to prompt for, cache and retrieve authorization information.

When using this class to cache, retrieve or prompt authentication information, you only need to set the necessary attributes. For example, to check whether a password is already cached, the only required information is the URL of the resource and optionally whether or not a path match should be performed. Similarly, to prompt for password you only need to optionally set the prompt, username (if already supplied), comment and commentLabel fields.

SPECIAL NOTE: If you extend this class to add additional parameters do not forget to overload the stream insertion and extraction operators ("<<" and ">>") so that the added data can be correctly serialized.

A two way messaging class for passing authentication information.

Author
Dawit Alemayehu adawi.nosp@m.t@kd.nosp@m.e.org

Member Enumeration Documentation

◆ FieldFlags

Flags for extra fields.

Definition at line 227 of file authinfo.h.

Constructor & Destructor Documentation

◆ AuthInfo() [1/2]

AuthInfo::AuthInfo ( )

Default constructor.

Definition at line 104 of file authinfo.cpp.

◆ AuthInfo() [2/2]

AuthInfo::AuthInfo ( const AuthInfo & info)

Copy constructor.

Definition at line 114 of file authinfo.cpp.

◆ ~AuthInfo()

AuthInfo::~AuthInfo ( )
default

Destructor.

Member Function Documentation

◆ getExtraField()

QVariant AuthInfo::getExtraField ( const QString & fieldName) const

Get Extra Field Value Check QVariant::isValid() to find out if the field exists.

Definition at line 164 of file authinfo.cpp.

◆ getExtraFieldFlags()

AuthInfo::FieldFlags AuthInfo::getExtraFieldFlags ( const QString & fieldName) const

Get Extra Field Flags.

Definition at line 173 of file authinfo.cpp.

◆ isModified()

bool AuthInfo::isModified ( ) const

Use this method to check if the object was modified.

Returns
true if the object has been modified

Definition at line 142 of file authinfo.cpp.

◆ operator=()

AuthInfo & AuthInfo::operator= ( const AuthInfo & info)

Custom assignment operator.

Definition at line 123 of file authinfo.cpp.

◆ registerMetaTypes()

void AuthInfo::registerMetaTypes ( )
static

Register the meta-types for AuthInfo.

This is called from AuthInfo's constructor but needed by daemons on the D-Bus such as kpasswdserver.

Definition at line 182 of file authinfo.cpp.

◆ setExtraField()

void AuthInfo::setExtraField ( const QString & fieldName,
const QVariant & value )

Set Extra Field Value.

Currently supported extra-fields: "domain" (QString), "anonymous" (bool) Setting it to an invalid QVariant() will disable the field. Extra Fields are disabled by default.

Definition at line 154 of file authinfo.cpp.

◆ setExtraFieldFlags()

void AuthInfo::setExtraFieldFlags ( const QString & fieldName,
const FieldFlags flags )

Set Extra Field Flags.

Definition at line 159 of file authinfo.cpp.

◆ setModified()

void AuthInfo::setModified ( bool flag)

Use this method to indicate that this object has been modified.

Parameters
flagtrue to mark the object as modified, false to clear

Definition at line 147 of file authinfo.cpp.

Member Data Documentation

◆ caption

QString KIO::AuthInfo::caption

The text to displayed in the title bar of the password prompting dialog.

Note
If this field is not set, the authentication dialog simply displays the preset default caption.

This setting is optional and empty by default.

Definition at line 132 of file authinfo.h.

◆ comment

QString KIO::AuthInfo::comment

Additional comment to be displayed when prompting the user for authentication information.

This field allows you to display a short (no more than 80 characters) extra description in the password prompt dialog. For example, this field along with the commentLabel can be used to describe the server that requested the authentication:

Server: Squid Proxy @ foo.com

where "Server:" is the commentLabel and the rest is the actual comment. Note that it is always better to use the commentLabel field as it will be placed properly in the dialog rather than to include it within the actual comment.

This setting is optional and empty by default.

Definition at line 156 of file authinfo.h.

◆ commentLabel

QString KIO::AuthInfo::commentLabel

Descriptive label to be displayed in front of the comment when prompting the user for password.

This setting is optional and only applicable when the comment field is also set.

Definition at line 165 of file authinfo.h.

◆ digestInfo

QString KIO::AuthInfo::digestInfo

Field to store any extra authentication information for protocols that need it.

This setting is optional and mostly applicable for HTTP protocol. However, any protocol can make use of it to store extra info.

Definition at line 189 of file authinfo.h.

◆ keepPassword

bool KIO::AuthInfo::keepPassword

Flag to indicate the persistence of the given password.

This is a two-way flag, when set before calling openPasswordDialog it makes the "keep Password" check box visible to the user. In return the flag will indicate the state of the check box. By default if the flag is checked the password will be cached for the entire life of the current KDE session otherwise the cached password is deleted right after the application using it has been closed.

Definition at line 222 of file authinfo.h.

◆ modified

bool KIO::AuthInfo::modified
protected

Definition at line 267 of file authinfo.h.

◆ password

QString KIO::AuthInfo::password

This is required for caching.

Definition at line 110 of file authinfo.h.

◆ prompt

QString KIO::AuthInfo::prompt

Information to be displayed when prompting the user for authentication information.

Note
If this field is not set, the authentication dialog simply displays the preset default prompt.

This setting is optional and empty by default.

Definition at line 121 of file authinfo.h.

◆ readOnly

bool KIO::AuthInfo::readOnly

Flag which if set forces the username field to be read-only.

This setting is optional and false by default.

Definition at line 209 of file authinfo.h.

◆ realmValue

QString KIO::AuthInfo::realmValue

A unique identifier that allows caching of multiple passwords for different resources in the same server.

Mostly this setting is applicable to the HTTP protocol whose authentication scheme explicitly defines the use of such a unique key. However, any protocol that can generate or supply a unique id can effectively use it to distinguish passwords.

This setting is optional and not set by default.

Definition at line 179 of file authinfo.h.

◆ url

QUrl KIO::AuthInfo::url

The URL for which authentication is to be stored.

This field is required when attempting to cache authorization and retrieve it. However, it is not needed when prompting the user for authorization info.

This setting is required except when prompting the user for password.

Definition at line 100 of file authinfo.h.

◆ username

QString KIO::AuthInfo::username

This is required for caching.

Definition at line 105 of file authinfo.h.

◆ verifyPath

bool KIO::AuthInfo::verifyPath

Flag that, if set, indicates whether a path match should be performed when requesting for cached authorization.

A path is deemed to be a match if it is equal to or is a subset of the cached path. For example, if stored path is "/foo/bar" and the request's path set to "/foo/bar/acme", then it is a match whereas it would not if the request's path was set to "/foo".

This setting is optional and false by default.

Definition at line 202 of file authinfo.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:09:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.