Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The abstract base class for handling authentication.
Specific HTTP Authentication mechanisms are implemented by its subclasses, but applications never need to be aware of the specific subclasses being used.
Auth
objects store the authentication data associated with a given bit
of web space. They are created automatically by [classsession
].
Synopsis
- newtype Auth = Auth (ManagedPtr Auth)
- class (GObject o, IsDescendantOf Auth o) => IsAuth o
- toAuth :: (MonadIO m, IsAuth o) => o -> m Auth
- authAuthenticate :: (HasCallStack, MonadIO m, IsAuth a) => a -> Text -> Text -> m ()
- authCanAuthenticate :: (HasCallStack, MonadIO m, IsAuth a) => a -> m Bool
- authCancel :: (HasCallStack, MonadIO m, IsAuth a) => a -> m ()
- authGetAuthority :: (HasCallStack, MonadIO m, IsAuth a) => a -> m Text
- authGetAuthorization :: (HasCallStack, MonadIO m, IsAuth a, IsMessage b) => a -> b -> m Text
- authGetInfo :: (HasCallStack, MonadIO m, IsAuth a) => a -> m Text
- authGetProtectionSpace :: (HasCallStack, MonadIO m, IsAuth a) => a -> Uri -> m [Text]
- authGetRealm :: (HasCallStack, MonadIO m, IsAuth a) => a -> m Text
- authGetSchemeName :: (HasCallStack, MonadIO m, IsAuth a) => a -> m Text
- authIsAuthenticated :: (HasCallStack, MonadIO m, IsAuth a) => a -> m Bool
- authIsCancelled :: (HasCallStack, MonadIO m, IsAuth a) => a -> m Bool
- authIsForProxy :: (HasCallStack, MonadIO m, IsAuth a) => a -> m Bool
- authIsReady :: (HasCallStack, MonadIO m, IsAuth a, IsMessage b) => a -> b -> m Bool
- authNew :: (HasCallStack, MonadIO m, IsMessage a) => GType -> a -> Text -> m (Maybe Auth)
- authUpdate :: (HasCallStack, MonadIO m, IsAuth a, IsMessage b) => a -> b -> Text -> m Bool
- clearAuthAuthority :: (MonadIO m, IsAuth o) => o -> m ()
- constructAuthAuthority :: (IsAuth o, MonadIO m) => Text -> m (GValueConstruct o)
- getAuthAuthority :: (MonadIO m, IsAuth o) => o -> m Text
- setAuthAuthority :: (MonadIO m, IsAuth o) => o -> Text -> m ()
- getAuthIsAuthenticated :: (MonadIO m, IsAuth o) => o -> m Bool
- getAuthIsCancelled :: (MonadIO m, IsAuth o) => o -> m Bool
- constructAuthIsForProxy :: (IsAuth o, MonadIO m) => Bool -> m (GValueConstruct o)
- getAuthIsForProxy :: (MonadIO m, IsAuth o) => o -> m Bool
- setAuthIsForProxy :: (MonadIO m, IsAuth o) => o -> Bool -> m ()
- clearAuthRealm :: (MonadIO m, IsAuth o) => o -> m ()
- constructAuthRealm :: (IsAuth o, MonadIO m) => Text -> m (GValueConstruct o)
- getAuthRealm :: (MonadIO m, IsAuth o) => o -> m Text
- setAuthRealm :: (MonadIO m, IsAuth o) => o -> Text -> m ()
- getAuthSchemeName :: (MonadIO m, IsAuth o) => o -> m Text
Exported types
Memory-managed wrapper type.
Instances
Eq Auth Source # | |
GObject Auth Source # | |
Defined in GI.Soup.Objects.Auth | |
ManagedPtrNewtype Auth Source # | |
Defined in GI.Soup.Objects.Auth toManagedPtr :: Auth -> ManagedPtr Auth | |
TypedObject Auth Source # | |
Defined in GI.Soup.Objects.Auth | |
HasParentTypes Auth Source # | |
Defined in GI.Soup.Objects.Auth | |
IsGValue (Maybe Auth) Source # | Convert |
Defined in GI.Soup.Objects.Auth gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Auth -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Auth) | |
type ParentTypes Auth Source # | |
Defined in GI.Soup.Objects.Auth type ParentTypes Auth = '[Object] |
class (GObject o, IsDescendantOf Auth o) => IsAuth o Source #
Instances
(GObject o, IsDescendantOf Auth o) => IsAuth o Source # | |
Defined in GI.Soup.Objects.Auth |
Methods
Click to display all available methods, including inherited ones
Methods
authenticate, bindProperty, bindPropertyFull, canAuthenticate, cancel, forceFloating, freezeNotify, getv, isAuthenticated, isCancelled, isFloating, isForProxy, isReady, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, update, watchClosure.
Getters
getAuthority, getAuthorization, getData, getInfo, getProperty, getProtectionSpace, getQdata, getRealm, getSchemeName.
Setters
authenticate
:: (HasCallStack, MonadIO m, IsAuth a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> m () |
Call this on an auth to authenticate it.
Normally this will cause the auth's message to be requeued with the new authentication info.
canAuthenticate
:: (HasCallStack, MonadIO m, IsAuth a) | |
=> a |
|
-> m Bool | Returns: |
Tests if auth
is able to authenticate by providing credentials to the
[methodauth
.authenticate].
cancel
:: (HasCallStack, MonadIO m, IsAuth a) | |
=> a |
|
-> m () |
Call this on an auth to cancel it.
You need to cancel an auth to complete an asynchronous authenticate operation
when no credentials are provided ([methodauth
.authenticate] is not called).
The Auth
will be cancelled on dispose if it hans't been authenticated.
getAuthority
:: (HasCallStack, MonadIO m, IsAuth a) | |
=> a |
|
-> m Text | Returns: the authority |
Returns the authority (host:port) that auth
is associated with.
getAuthorization
:: (HasCallStack, MonadIO m, IsAuth a, IsMessage b) | |
=> a |
|
-> b |
|
-> m Text | Returns: the "Authorization" header, which must be freed. |
Generates an appropriate "Authorization" header for msg
.
(The session will only call this if [methodauth
.is_authenticated] returned
True
.)
getInfo
:: (HasCallStack, MonadIO m, IsAuth a) | |
=> a |
|
-> m Text | Returns: the identifier |
Gets an opaque identifier for auth
.
The identifier can be used as a hash key or the like. Auth
objects from
the same server with the same identifier refer to the same authentication
domain (eg, the URLs associated with them take the same usernames and
passwords).
getProtectionSpace
authGetProtectionSpace Source #
:: (HasCallStack, MonadIO m, IsAuth a) | |
=> a |
|
-> Uri |
|
-> m [Text] | Returns: the list of
paths, which can be freed with [method |
Returns a list of paths on the server which auth
extends over.
(All subdirectories of these paths are also assumed to be part
of auth
's protection space, unless otherwise discovered not to
be.)
getRealm
:: (HasCallStack, MonadIO m, IsAuth a) | |
=> a |
|
-> m Text | Returns: the realm name |
Returns auth
's realm.
This is an identifier that distinguishes separate authentication spaces on a given server, and may be some string that is meaningful to the user. (Although it is probably not localized.)
getSchemeName
:: (HasCallStack, MonadIO m, IsAuth a) | |
=> a |
|
-> m Text | Returns: the scheme name |
soup_auth_get_scheme_name: (attributes org.gtk.Method.get_property=scheme-name)
Returns auth
's scheme name. (Eg, "Basic", "Digest", or "NTLM")
isAuthenticated
:: (HasCallStack, MonadIO m, IsAuth a) | |
=> a |
|
-> m Bool | Returns: |
Tests if auth
has been given a username and password.
isCancelled
:: (HasCallStack, MonadIO m, IsAuth a) | |
=> a |
|
-> m Bool | Returns: |
Tests if auth
has been cancelled
isForProxy
Tests whether or not auth
is associated with a proxy server rather
than an "origin" server.
isReady
:: (HasCallStack, MonadIO m, IsAuth a, IsMessage b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: |
Tests if auth
is ready to make a request for msg
with.
For most auths, this is equivalent to [methodauth
.is_authenticated], but for
some auth types (eg, NTLM), the auth may be sendable (eg, as an
authentication request) even before it is authenticated.
new
:: (HasCallStack, MonadIO m, IsMessage a) | |
=> GType |
|
-> a |
|
-> Text |
|
-> m (Maybe Auth) | Returns: the new |
Creates a new Auth
of type type
with the information from
msg
and authHeader
.
This is called by [classsession
]; you will normally not create auths
yourself.
update
:: (HasCallStack, MonadIO m, IsAuth a, IsMessage b) | |
=> a |
|
-> b |
|
-> Text |
|
-> m Bool | Returns: |
Updates auth
with the information from msg
and authHeader
,
possibly un-authenticating it.
As with [ctorauth
.new], this is normally only used by [classsession
].
Properties
authority
The authority (host:port) being authenticated to.
clearAuthAuthority :: (MonadIO m, IsAuth o) => o -> m () Source #
Set the value of the “authority
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#authority
constructAuthAuthority :: (IsAuth o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “authority
” property. This is rarely needed directly, but it is used by new
.
getAuthAuthority :: (MonadIO m, IsAuth o) => o -> m Text Source #
Get the value of the “authority
” property.
When overloading is enabled, this is equivalent to
get
auth #authority
setAuthAuthority :: (MonadIO m, IsAuth o) => o -> Text -> m () Source #
Set the value of the “authority
” property.
When overloading is enabled, this is equivalent to
set
auth [ #authority:=
value ]
isAuthenticated
Whether or not the auth has been authenticated.
getAuthIsAuthenticated :: (MonadIO m, IsAuth o) => o -> m Bool Source #
Get the value of the “is-authenticated
” property.
When overloading is enabled, this is equivalent to
get
auth #isAuthenticated
isCancelled
Whether or not the auth has been cancelled.
getAuthIsCancelled :: (MonadIO m, IsAuth o) => o -> m Bool Source #
Get the value of the “is-cancelled
” property.
When overloading is enabled, this is equivalent to
get
auth #isCancelled
isForProxy
Whether or not the auth is for a proxy server.
constructAuthIsForProxy :: (IsAuth o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “is-for-proxy
” property. This is rarely needed directly, but it is used by new
.
getAuthIsForProxy :: (MonadIO m, IsAuth o) => o -> m Bool Source #
Get the value of the “is-for-proxy
” property.
When overloading is enabled, this is equivalent to
get
auth #isForProxy
setAuthIsForProxy :: (MonadIO m, IsAuth o) => o -> Bool -> m () Source #
Set the value of the “is-for-proxy
” property.
When overloading is enabled, this is equivalent to
set
auth [ #isForProxy:=
value ]
realm
The authentication realm.
clearAuthRealm :: (MonadIO m, IsAuth o) => o -> m () Source #
Set the value of the “realm
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#realm
constructAuthRealm :: (IsAuth o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “realm
” property. This is rarely needed directly, but it is used by new
.
getAuthRealm :: (MonadIO m, IsAuth o) => o -> m Text Source #
Get the value of the “realm
” property.
When overloading is enabled, this is equivalent to
get
auth #realm
setAuthRealm :: (MonadIO m, IsAuth o) => o -> Text -> m () Source #
Set the value of the “realm
” property.
When overloading is enabled, this is equivalent to
set
auth [ #realm:=
value ]
schemeName
The authentication scheme name.
getAuthSchemeName :: (MonadIO m, IsAuth o) => o -> m Text Source #
Get the value of the “scheme-name
” property.
When overloading is enabled, this is equivalent to
get
auth #schemeName