gi-soup-2.4.18: GI/Soup/Objects/Auth.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
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.
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Soup.Objects.Auth
(
-- * Exported types
Auth(..) ,
IsAuth ,
toAuth ,
noAuth ,
-- * Methods
-- ** authenticate #method:authenticate#
#if ENABLE_OVERLOADING
AuthAuthenticateMethodInfo ,
#endif
authAuthenticate ,
-- ** canAuthenticate #method:canAuthenticate#
#if ENABLE_OVERLOADING
AuthCanAuthenticateMethodInfo ,
#endif
authCanAuthenticate ,
-- ** getAuthorization #method:getAuthorization#
#if ENABLE_OVERLOADING
AuthGetAuthorizationMethodInfo ,
#endif
authGetAuthorization ,
-- ** getHost #method:getHost#
#if ENABLE_OVERLOADING
AuthGetHostMethodInfo ,
#endif
authGetHost ,
-- ** getInfo #method:getInfo#
#if ENABLE_OVERLOADING
AuthGetInfoMethodInfo ,
#endif
authGetInfo ,
-- ** getProtectionSpace #method:getProtectionSpace#
#if ENABLE_OVERLOADING
AuthGetProtectionSpaceMethodInfo ,
#endif
authGetProtectionSpace ,
-- ** getRealm #method:getRealm#
#if ENABLE_OVERLOADING
AuthGetRealmMethodInfo ,
#endif
authGetRealm ,
-- ** getSavedPassword #method:getSavedPassword#
#if ENABLE_OVERLOADING
AuthGetSavedPasswordMethodInfo ,
#endif
authGetSavedPassword ,
-- ** getSavedUsers #method:getSavedUsers#
#if ENABLE_OVERLOADING
AuthGetSavedUsersMethodInfo ,
#endif
authGetSavedUsers ,
-- ** getSchemeName #method:getSchemeName#
#if ENABLE_OVERLOADING
AuthGetSchemeNameMethodInfo ,
#endif
authGetSchemeName ,
-- ** hasSavedPassword #method:hasSavedPassword#
#if ENABLE_OVERLOADING
AuthHasSavedPasswordMethodInfo ,
#endif
authHasSavedPassword ,
-- ** isAuthenticated #method:isAuthenticated#
#if ENABLE_OVERLOADING
AuthIsAuthenticatedMethodInfo ,
#endif
authIsAuthenticated ,
-- ** isForProxy #method:isForProxy#
#if ENABLE_OVERLOADING
AuthIsForProxyMethodInfo ,
#endif
authIsForProxy ,
-- ** isReady #method:isReady#
#if ENABLE_OVERLOADING
AuthIsReadyMethodInfo ,
#endif
authIsReady ,
-- ** new #method:new#
authNew ,
-- ** savePassword #method:savePassword#
#if ENABLE_OVERLOADING
AuthSavePasswordMethodInfo ,
#endif
authSavePassword ,
-- ** update #method:update#
#if ENABLE_OVERLOADING
AuthUpdateMethodInfo ,
#endif
authUpdate ,
-- * Properties
-- ** host #attr:host#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
AuthHostPropertyInfo ,
#endif
#if ENABLE_OVERLOADING
authHost ,
#endif
clearAuthHost ,
constructAuthHost ,
getAuthHost ,
setAuthHost ,
-- ** isAuthenticated #attr:isAuthenticated#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
AuthIsAuthenticatedPropertyInfo ,
#endif
getAuthIsAuthenticated ,
-- ** isForProxy #attr:isForProxy#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
AuthIsForProxyPropertyInfo ,
#endif
constructAuthIsForProxy ,
getAuthIsForProxy ,
setAuthIsForProxy ,
-- ** realm #attr:realm#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
AuthRealmPropertyInfo ,
#endif
#if ENABLE_OVERLOADING
authRealm ,
#endif
clearAuthRealm ,
constructAuthRealm ,
getAuthRealm ,
setAuthRealm ,
-- ** schemeName #attr:schemeName#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
AuthSchemeNamePropertyInfo ,
#endif
#if ENABLE_OVERLOADING
authSchemeName ,
#endif
getAuthSchemeName ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Soup.Objects.Message as Soup.Message
import {-# SOURCE #-} qualified GI.Soup.Structs.URI as Soup.URI
-- | Memory-managed wrapper type.
newtype Auth = Auth (ManagedPtr Auth)
foreign import ccall "soup_auth_get_type"
c_soup_auth_get_type :: IO GType
instance GObject Auth where
gobjectType = c_soup_auth_get_type
-- | Type class for types which can be safely cast to `Auth`, for instance with `toAuth`.
class (GObject o, O.IsDescendantOf Auth o) => IsAuth o
instance (GObject o, O.IsDescendantOf Auth o) => IsAuth o
instance O.HasParentTypes Auth
type instance O.ParentTypes Auth = '[GObject.Object.Object]
-- | Cast to `Auth`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toAuth :: (MonadIO m, IsAuth o) => o -> m Auth
toAuth = liftIO . unsafeCastTo Auth
-- | A convenience alias for `Nothing` :: `Maybe` `Auth`.
noAuth :: Maybe Auth
noAuth = Nothing
#if ENABLE_OVERLOADING
type family ResolveAuthMethod (t :: Symbol) (o :: *) :: * where
ResolveAuthMethod "authenticate" o = AuthAuthenticateMethodInfo
ResolveAuthMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveAuthMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveAuthMethod "canAuthenticate" o = AuthCanAuthenticateMethodInfo
ResolveAuthMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveAuthMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveAuthMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveAuthMethod "hasSavedPassword" o = AuthHasSavedPasswordMethodInfo
ResolveAuthMethod "isAuthenticated" o = AuthIsAuthenticatedMethodInfo
ResolveAuthMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveAuthMethod "isForProxy" o = AuthIsForProxyMethodInfo
ResolveAuthMethod "isReady" o = AuthIsReadyMethodInfo
ResolveAuthMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveAuthMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveAuthMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveAuthMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveAuthMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveAuthMethod "savePassword" o = AuthSavePasswordMethodInfo
ResolveAuthMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveAuthMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveAuthMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveAuthMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveAuthMethod "update" o = AuthUpdateMethodInfo
ResolveAuthMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveAuthMethod "getAuthorization" o = AuthGetAuthorizationMethodInfo
ResolveAuthMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveAuthMethod "getHost" o = AuthGetHostMethodInfo
ResolveAuthMethod "getInfo" o = AuthGetInfoMethodInfo
ResolveAuthMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveAuthMethod "getProtectionSpace" o = AuthGetProtectionSpaceMethodInfo
ResolveAuthMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveAuthMethod "getRealm" o = AuthGetRealmMethodInfo
ResolveAuthMethod "getSavedPassword" o = AuthGetSavedPasswordMethodInfo
ResolveAuthMethod "getSavedUsers" o = AuthGetSavedUsersMethodInfo
ResolveAuthMethod "getSchemeName" o = AuthGetSchemeNameMethodInfo
ResolveAuthMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveAuthMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveAuthMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAuthMethod t Auth, O.MethodInfo info Auth p) => OL.IsLabel t (Auth -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
-- VVV Prop "host"
-- Type: TBasicType TUTF8
-- Flags: [PropertyReadable,PropertyWritable]
-- Nullable: (Just False,Nothing)
{- |
Get the value of the “@host@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' auth #host
@
-}
getAuthHost :: (MonadIO m, IsAuth o) => o -> m T.Text
getAuthHost obj = liftIO $ checkUnexpectedNothing "getAuthHost" $ B.Properties.getObjectPropertyString obj "host"
{- |
Set the value of the “@host@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' auth [ #host 'Data.GI.Base.Attributes.:=' value ]
@
-}
setAuthHost :: (MonadIO m, IsAuth o) => o -> T.Text -> m ()
setAuthHost obj val = liftIO $ B.Properties.setObjectPropertyString obj "host" (Just val)
{- |
Construct a `GValueConstruct` with valid value for the “@host@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructAuthHost :: (IsAuth o) => T.Text -> IO (GValueConstruct o)
constructAuthHost val = B.Properties.constructObjectPropertyString "host" (Just val)
{- |
Set the value of the “@host@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.clear' #host
@
-}
clearAuthHost :: (MonadIO m, IsAuth o) => o -> m ()
clearAuthHost obj = liftIO $ B.Properties.setObjectPropertyString obj "host" (Nothing :: Maybe T.Text)
#if ENABLE_OVERLOADING
data AuthHostPropertyInfo
instance AttrInfo AuthHostPropertyInfo where
type AttrAllowedOps AuthHostPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint AuthHostPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint AuthHostPropertyInfo = IsAuth
type AttrGetType AuthHostPropertyInfo = T.Text
type AttrLabel AuthHostPropertyInfo = "host"
type AttrOrigin AuthHostPropertyInfo = Auth
attrGet _ = getAuthHost
attrSet _ = setAuthHost
attrConstruct _ = constructAuthHost
attrClear _ = clearAuthHost
#endif
-- VVV Prop "is-authenticated"
-- Type: TBasicType TBoolean
-- Flags: [PropertyReadable]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@is-authenticated@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' auth #isAuthenticated
@
-}
getAuthIsAuthenticated :: (MonadIO m, IsAuth o) => o -> m Bool
getAuthIsAuthenticated obj = liftIO $ B.Properties.getObjectPropertyBool obj "is-authenticated"
#if ENABLE_OVERLOADING
data AuthIsAuthenticatedPropertyInfo
instance AttrInfo AuthIsAuthenticatedPropertyInfo where
type AttrAllowedOps AuthIsAuthenticatedPropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint AuthIsAuthenticatedPropertyInfo = (~) ()
type AttrBaseTypeConstraint AuthIsAuthenticatedPropertyInfo = IsAuth
type AttrGetType AuthIsAuthenticatedPropertyInfo = Bool
type AttrLabel AuthIsAuthenticatedPropertyInfo = "is-authenticated"
type AttrOrigin AuthIsAuthenticatedPropertyInfo = Auth
attrGet _ = getAuthIsAuthenticated
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
-- VVV Prop "is-for-proxy"
-- Type: TBasicType TBoolean
-- Flags: [PropertyReadable,PropertyWritable]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@is-for-proxy@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' auth #isForProxy
@
-}
getAuthIsForProxy :: (MonadIO m, IsAuth o) => o -> m Bool
getAuthIsForProxy obj = liftIO $ B.Properties.getObjectPropertyBool obj "is-for-proxy"
{- |
Set the value of the “@is-for-proxy@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' auth [ #isForProxy 'Data.GI.Base.Attributes.:=' value ]
@
-}
setAuthIsForProxy :: (MonadIO m, IsAuth o) => o -> Bool -> m ()
setAuthIsForProxy obj val = liftIO $ B.Properties.setObjectPropertyBool obj "is-for-proxy" val
{- |
Construct a `GValueConstruct` with valid value for the “@is-for-proxy@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructAuthIsForProxy :: (IsAuth o) => Bool -> IO (GValueConstruct o)
constructAuthIsForProxy val = B.Properties.constructObjectPropertyBool "is-for-proxy" val
#if ENABLE_OVERLOADING
data AuthIsForProxyPropertyInfo
instance AttrInfo AuthIsForProxyPropertyInfo where
type AttrAllowedOps AuthIsForProxyPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint AuthIsForProxyPropertyInfo = (~) Bool
type AttrBaseTypeConstraint AuthIsForProxyPropertyInfo = IsAuth
type AttrGetType AuthIsForProxyPropertyInfo = Bool
type AttrLabel AuthIsForProxyPropertyInfo = "is-for-proxy"
type AttrOrigin AuthIsForProxyPropertyInfo = Auth
attrGet _ = getAuthIsForProxy
attrSet _ = setAuthIsForProxy
attrConstruct _ = constructAuthIsForProxy
attrClear _ = undefined
#endif
-- VVV Prop "realm"
-- Type: TBasicType TUTF8
-- Flags: [PropertyReadable,PropertyWritable]
-- Nullable: (Just False,Nothing)
{- |
Get the value of the “@realm@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' auth #realm
@
-}
getAuthRealm :: (MonadIO m, IsAuth o) => o -> m T.Text
getAuthRealm obj = liftIO $ checkUnexpectedNothing "getAuthRealm" $ B.Properties.getObjectPropertyString obj "realm"
{- |
Set the value of the “@realm@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' auth [ #realm 'Data.GI.Base.Attributes.:=' value ]
@
-}
setAuthRealm :: (MonadIO m, IsAuth o) => o -> T.Text -> m ()
setAuthRealm obj val = liftIO $ B.Properties.setObjectPropertyString obj "realm" (Just val)
{- |
Construct a `GValueConstruct` with valid value for the “@realm@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructAuthRealm :: (IsAuth o) => T.Text -> IO (GValueConstruct o)
constructAuthRealm val = B.Properties.constructObjectPropertyString "realm" (Just val)
{- |
Set the value of the “@realm@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.clear' #realm
@
-}
clearAuthRealm :: (MonadIO m, IsAuth o) => o -> m ()
clearAuthRealm obj = liftIO $ B.Properties.setObjectPropertyString obj "realm" (Nothing :: Maybe T.Text)
#if ENABLE_OVERLOADING
data AuthRealmPropertyInfo
instance AttrInfo AuthRealmPropertyInfo where
type AttrAllowedOps AuthRealmPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint AuthRealmPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint AuthRealmPropertyInfo = IsAuth
type AttrGetType AuthRealmPropertyInfo = T.Text
type AttrLabel AuthRealmPropertyInfo = "realm"
type AttrOrigin AuthRealmPropertyInfo = Auth
attrGet _ = getAuthRealm
attrSet _ = setAuthRealm
attrConstruct _ = constructAuthRealm
attrClear _ = clearAuthRealm
#endif
-- VVV Prop "scheme-name"
-- Type: TBasicType TUTF8
-- Flags: [PropertyReadable]
-- Nullable: (Just False,Nothing)
{- |
Get the value of the “@scheme-name@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' auth #schemeName
@
-}
getAuthSchemeName :: (MonadIO m, IsAuth o) => o -> m T.Text
getAuthSchemeName obj = liftIO $ checkUnexpectedNothing "getAuthSchemeName" $ B.Properties.getObjectPropertyString obj "scheme-name"
#if ENABLE_OVERLOADING
data AuthSchemeNamePropertyInfo
instance AttrInfo AuthSchemeNamePropertyInfo where
type AttrAllowedOps AuthSchemeNamePropertyInfo = '[ 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint AuthSchemeNamePropertyInfo = (~) ()
type AttrBaseTypeConstraint AuthSchemeNamePropertyInfo = IsAuth
type AttrGetType AuthSchemeNamePropertyInfo = T.Text
type AttrLabel AuthSchemeNamePropertyInfo = "scheme-name"
type AttrOrigin AuthSchemeNamePropertyInfo = Auth
attrGet _ = getAuthSchemeName
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList Auth
type instance O.AttributeList Auth = AuthAttributeList
type AuthAttributeList = ('[ '("host", AuthHostPropertyInfo), '("isAuthenticated", AuthIsAuthenticatedPropertyInfo), '("isForProxy", AuthIsForProxyPropertyInfo), '("realm", AuthRealmPropertyInfo), '("schemeName", AuthSchemeNamePropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
authHost :: AttrLabelProxy "host"
authHost = AttrLabelProxy
authRealm :: AttrLabelProxy "realm"
authRealm = AttrLabelProxy
authSchemeName :: AttrLabelProxy "schemeName"
authSchemeName = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList Auth = AuthSignalList
type AuthSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
-- method Auth::new
-- method type : Constructor
-- Args : [Arg {argCName = "type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the type of auth to create (a subtype of #SoupAuth)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #SoupMessage the auth is being created for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "auth_header", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WWW-Authenticate/Proxy-Authenticate header", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "Auth"}))
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_new" soup_auth_new ::
CGType -> -- type : TBasicType TGType
Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
CString -> -- auth_header : TBasicType TUTF8
IO (Ptr Auth)
{- |
Creates a new 'GI.Soup.Objects.Auth.Auth' of type /@type@/ with the information from
/@msg@/ and /@authHeader@/.
This is called by 'GI.Soup.Objects.Session.Session'; you will normally not create auths
yourself.
-}
authNew ::
(B.CallStack.HasCallStack, MonadIO m, Soup.Message.IsMessage a) =>
GType
{- ^ /@type@/: the type of auth to create (a subtype of 'GI.Soup.Objects.Auth.Auth') -}
-> a
{- ^ /@msg@/: the 'GI.Soup.Objects.Message.Message' the auth is being created for -}
-> T.Text
{- ^ /@authHeader@/: the WWW-Authenticate\/Proxy-Authenticate header -}
-> m (Maybe Auth)
{- ^ __Returns:__ the new 'GI.Soup.Objects.Auth.Auth', or 'Nothing' if it could
not be created -}
authNew type_ msg authHeader = liftIO $ do
let type_' = gtypeToCGType type_
msg' <- unsafeManagedPtrCastPtr msg
authHeader' <- textToCString authHeader
result <- soup_auth_new type_' msg' authHeader'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Auth) result'
return result''
touchManagedPtr msg
freeMem authHeader'
return maybeResult
#if ENABLE_OVERLOADING
#endif
-- method Auth::authenticate
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupAuth", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "username", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the username provided by the user or client", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "password", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the password provided by the user or client", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_authenticate" soup_auth_authenticate ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
CString -> -- username : TBasicType TUTF8
CString -> -- password : TBasicType TUTF8
IO ()
{- |
Call this on an auth to authenticate it; normally this will cause
the auth\'s message to be requeued with the new authentication info.
-}
authAuthenticate ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
{- ^ /@auth@/: a 'GI.Soup.Objects.Auth.Auth' -}
-> T.Text
{- ^ /@username@/: the username provided by the user or client -}
-> T.Text
{- ^ /@password@/: the password provided by the user or client -}
-> m ()
authAuthenticate auth username password = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
username' <- textToCString username
password' <- textToCString password
soup_auth_authenticate auth' username' password'
touchManagedPtr auth
freeMem username'
freeMem password'
return ()
#if ENABLE_OVERLOADING
data AuthAuthenticateMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m, IsAuth a) => O.MethodInfo AuthAuthenticateMethodInfo a signature where
overloadedMethod _ = authAuthenticate
#endif
-- method Auth::can_authenticate
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupAuth", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_can_authenticate" soup_auth_can_authenticate ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
IO CInt
{- |
Tests if /@auth@/ is able to authenticate by providing credentials to the
'GI.Soup.Objects.Auth.authAuthenticate'.
/Since: 2.54/
-}
authCanAuthenticate ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
{- ^ /@auth@/: a 'GI.Soup.Objects.Auth.Auth' -}
-> m Bool
{- ^ __Returns:__ 'True' if /@auth@/ is able to accept credentials. -}
authCanAuthenticate auth = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
result <- soup_auth_can_authenticate auth'
let result' = (/= 0) result
touchManagedPtr auth
return result'
#if ENABLE_OVERLOADING
data AuthCanAuthenticateMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsAuth a) => O.MethodInfo AuthCanAuthenticateMethodInfo a signature where
overloadedMethod _ = authCanAuthenticate
#endif
-- method Auth::get_authorization
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupAuth", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #SoupMessage to be authorized", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_get_authorization" soup_auth_get_authorization ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
IO CString
{- |
Generates an appropriate \"Authorization\" header for /@msg@/. (The
session will only call this if 'GI.Soup.Objects.Auth.authIsAuthenticated'
returned 'True'.)
-}
authGetAuthorization ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a, Soup.Message.IsMessage b) =>
a
{- ^ /@auth@/: a 'GI.Soup.Objects.Auth.Auth' -}
-> b
{- ^ /@msg@/: the 'GI.Soup.Objects.Message.Message' to be authorized -}
-> m T.Text
{- ^ __Returns:__ the \"Authorization\" header, which must be freed. -}
authGetAuthorization auth msg = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
msg' <- unsafeManagedPtrCastPtr msg
result <- soup_auth_get_authorization auth' msg'
checkUnexpectedReturnNULL "authGetAuthorization" result
result' <- cstringToText result
freeMem result
touchManagedPtr auth
touchManagedPtr msg
return result'
#if ENABLE_OVERLOADING
data AuthGetAuthorizationMethodInfo
instance (signature ~ (b -> m T.Text), MonadIO m, IsAuth a, Soup.Message.IsMessage b) => O.MethodInfo AuthGetAuthorizationMethodInfo a signature where
overloadedMethod _ = authGetAuthorization
#endif
-- method Auth::get_host
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupAuth", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_get_host" soup_auth_get_host ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
IO CString
{- |
Returns the host that /@auth@/ is associated with.
-}
authGetHost ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
{- ^ /@auth@/: a 'GI.Soup.Objects.Auth.Auth' -}
-> m T.Text
{- ^ __Returns:__ the hostname -}
authGetHost auth = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
result <- soup_auth_get_host auth'
checkUnexpectedReturnNULL "authGetHost" result
result' <- cstringToText result
touchManagedPtr auth
return result'
#if ENABLE_OVERLOADING
data AuthGetHostMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsAuth a) => O.MethodInfo AuthGetHostMethodInfo a signature where
overloadedMethod _ = authGetHost
#endif
-- method Auth::get_info
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupAuth", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_get_info" soup_auth_get_info ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
IO CString
{- |
Gets an opaque identifier for /@auth@/, for use as a hash key or the
like. 'GI.Soup.Objects.Auth.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).
-}
authGetInfo ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
{- ^ /@auth@/: a 'GI.Soup.Objects.Auth.Auth' -}
-> m T.Text
{- ^ __Returns:__ the identifier -}
authGetInfo auth = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
result <- soup_auth_get_info auth'
checkUnexpectedReturnNULL "authGetInfo" result
result' <- cstringToText result
freeMem result
touchManagedPtr auth
return result'
#if ENABLE_OVERLOADING
data AuthGetInfoMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsAuth a) => O.MethodInfo AuthGetInfoMethodInfo a signature where
overloadedMethod _ = authGetInfo
#endif
-- method Auth::get_protection_space
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupAuth", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "source_uri", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI of the request that @auth was generated in\nresponse to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGSList (TBasicType TUTF8))
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_get_protection_space" soup_auth_get_protection_space ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
Ptr Soup.URI.URI -> -- source_uri : TInterface (Name {namespace = "Soup", name = "URI"})
IO (Ptr (GSList CString))
{- |
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.)
-}
authGetProtectionSpace ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
{- ^ /@auth@/: a 'GI.Soup.Objects.Auth.Auth' -}
-> Soup.URI.URI
{- ^ /@sourceUri@/: the URI of the request that /@auth@/ was generated in
response to. -}
-> m [T.Text]
{- ^ __Returns:__ the list of
paths, which can be freed with @/soup_auth_free_protection_space()/@. -}
authGetProtectionSpace auth sourceUri = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
sourceUri' <- unsafeManagedPtrGetPtr sourceUri
result <- soup_auth_get_protection_space auth' sourceUri'
result' <- unpackGSList result
result'' <- mapM cstringToText result'
mapGSList freeMem result
g_slist_free result
touchManagedPtr auth
touchManagedPtr sourceUri
return result''
#if ENABLE_OVERLOADING
data AuthGetProtectionSpaceMethodInfo
instance (signature ~ (Soup.URI.URI -> m [T.Text]), MonadIO m, IsAuth a) => O.MethodInfo AuthGetProtectionSpaceMethodInfo a signature where
overloadedMethod _ = authGetProtectionSpace
#endif
-- method Auth::get_realm
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupAuth", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_get_realm" soup_auth_get_realm ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
IO CString
{- |
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.)
-}
authGetRealm ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
{- ^ /@auth@/: a 'GI.Soup.Objects.Auth.Auth' -}
-> m T.Text
{- ^ __Returns:__ the realm name -}
authGetRealm auth = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
result <- soup_auth_get_realm auth'
checkUnexpectedReturnNULL "authGetRealm" result
result' <- cstringToText result
touchManagedPtr auth
return result'
#if ENABLE_OVERLOADING
data AuthGetRealmMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsAuth a) => O.MethodInfo AuthGetRealmMethodInfo a signature where
overloadedMethod _ = authGetRealm
#endif
-- method Auth::get_saved_password
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_get_saved_password" soup_auth_get_saved_password ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
CString -> -- user : TBasicType TUTF8
IO CString
{- |
/No description available in the introspection data./
-}
authGetSavedPassword ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
-> T.Text
-> m T.Text
authGetSavedPassword auth user = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
user' <- textToCString user
result <- soup_auth_get_saved_password auth' user'
checkUnexpectedReturnNULL "authGetSavedPassword" result
result' <- cstringToText result
touchManagedPtr auth
freeMem user'
return result'
#if ENABLE_OVERLOADING
data AuthGetSavedPasswordMethodInfo
instance (signature ~ (T.Text -> m T.Text), MonadIO m, IsAuth a) => O.MethodInfo AuthGetSavedPasswordMethodInfo a signature where
overloadedMethod _ = authGetSavedPassword
#endif
-- method Auth::get_saved_users
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGSList (TBasicType TUTF8))
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_get_saved_users" soup_auth_get_saved_users ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
IO (Ptr (GSList CString))
{- |
/No description available in the introspection data./
-}
authGetSavedUsers ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
-> m [T.Text]
authGetSavedUsers auth = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
result <- soup_auth_get_saved_users auth'
result' <- unpackGSList result
result'' <- mapM cstringToText result'
mapGSList freeMem result
g_slist_free result
touchManagedPtr auth
return result''
#if ENABLE_OVERLOADING
data AuthGetSavedUsersMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsAuth a) => O.MethodInfo AuthGetSavedUsersMethodInfo a signature where
overloadedMethod _ = authGetSavedUsers
#endif
-- method Auth::get_scheme_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupAuth", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_get_scheme_name" soup_auth_get_scheme_name ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
IO CString
{- |
Returns /@auth@/\'s scheme name. (Eg, \"Basic\", \"Digest\", or \"NTLM\")
-}
authGetSchemeName ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
{- ^ /@auth@/: a 'GI.Soup.Objects.Auth.Auth' -}
-> m T.Text
{- ^ __Returns:__ the scheme name -}
authGetSchemeName auth = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
result <- soup_auth_get_scheme_name auth'
checkUnexpectedReturnNULL "authGetSchemeName" result
result' <- cstringToText result
touchManagedPtr auth
return result'
#if ENABLE_OVERLOADING
data AuthGetSchemeNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsAuth a) => O.MethodInfo AuthGetSchemeNameMethodInfo a signature where
overloadedMethod _ = authGetSchemeName
#endif
-- method Auth::has_saved_password
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "username", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "password", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_has_saved_password" soup_auth_has_saved_password ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
CString -> -- username : TBasicType TUTF8
CString -> -- password : TBasicType TUTF8
IO ()
{- |
/No description available in the introspection data./
-}
authHasSavedPassword ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
-> T.Text
-> T.Text
-> m ()
authHasSavedPassword auth username password = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
username' <- textToCString username
password' <- textToCString password
soup_auth_has_saved_password auth' username' password'
touchManagedPtr auth
freeMem username'
freeMem password'
return ()
#if ENABLE_OVERLOADING
data AuthHasSavedPasswordMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m, IsAuth a) => O.MethodInfo AuthHasSavedPasswordMethodInfo a signature where
overloadedMethod _ = authHasSavedPassword
#endif
-- method Auth::is_authenticated
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupAuth", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_is_authenticated" soup_auth_is_authenticated ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
IO CInt
{- |
Tests if /@auth@/ has been given a username and password
-}
authIsAuthenticated ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
{- ^ /@auth@/: a 'GI.Soup.Objects.Auth.Auth' -}
-> m Bool
{- ^ __Returns:__ 'True' if /@auth@/ has been given a username and password -}
authIsAuthenticated auth = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
result <- soup_auth_is_authenticated auth'
let result' = (/= 0) result
touchManagedPtr auth
return result'
#if ENABLE_OVERLOADING
data AuthIsAuthenticatedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsAuth a) => O.MethodInfo AuthIsAuthenticatedMethodInfo a signature where
overloadedMethod _ = authIsAuthenticated
#endif
-- method Auth::is_for_proxy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupAuth", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_is_for_proxy" soup_auth_is_for_proxy ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
IO CInt
{- |
Tests whether or not /@auth@/ is associated with a proxy server rather
than an \"origin\" server.
-}
authIsForProxy ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
{- ^ /@auth@/: a 'GI.Soup.Objects.Auth.Auth' -}
-> m Bool
{- ^ __Returns:__ 'True' or 'False' -}
authIsForProxy auth = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
result <- soup_auth_is_for_proxy auth'
let result' = (/= 0) result
touchManagedPtr auth
return result'
#if ENABLE_OVERLOADING
data AuthIsForProxyMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsAuth a) => O.MethodInfo AuthIsForProxyMethodInfo a signature where
overloadedMethod _ = authIsForProxy
#endif
-- method Auth::is_ready
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupAuth", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupMessage", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_is_ready" soup_auth_is_ready ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
IO CInt
{- |
Tests if /@auth@/ is ready to make a request for /@msg@/ with. For most
auths, this is equivalent to 'GI.Soup.Objects.Auth.authIsAuthenticated', but for
some auth types (eg, NTLM), the auth may be sendable (eg, as an
authentication request) even before it is authenticated.
/Since: 2.42/
-}
authIsReady ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a, Soup.Message.IsMessage b) =>
a
{- ^ /@auth@/: a 'GI.Soup.Objects.Auth.Auth' -}
-> b
{- ^ /@msg@/: a 'GI.Soup.Objects.Message.Message' -}
-> m Bool
{- ^ __Returns:__ 'True' if /@auth@/ is ready to make a request with. -}
authIsReady auth msg = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
msg' <- unsafeManagedPtrCastPtr msg
result <- soup_auth_is_ready auth' msg'
let result' = (/= 0) result
touchManagedPtr auth
touchManagedPtr msg
return result'
#if ENABLE_OVERLOADING
data AuthIsReadyMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsAuth a, Soup.Message.IsMessage b) => O.MethodInfo AuthIsReadyMethodInfo a signature where
overloadedMethod _ = authIsReady
#endif
-- method Auth::save_password
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "username", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "password", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_save_password" soup_auth_save_password ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
CString -> -- username : TBasicType TUTF8
CString -> -- password : TBasicType TUTF8
IO ()
{- |
/No description available in the introspection data./
-}
authSavePassword ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a) =>
a
-> T.Text
-> T.Text
-> m ()
authSavePassword auth username password = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
username' <- textToCString username
password' <- textToCString password
soup_auth_save_password auth' username' password'
touchManagedPtr auth
freeMem username'
freeMem password'
return ()
#if ENABLE_OVERLOADING
data AuthSavePasswordMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m, IsAuth a) => O.MethodInfo AuthSavePasswordMethodInfo a signature where
overloadedMethod _ = authSavePassword
#endif
-- method Auth::update
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "auth", argType = TInterface (Name {namespace = "Soup", name = "Auth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #SoupAuth", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "msg", argType = TInterface (Name {namespace = "Soup", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #SoupMessage @auth is being updated for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "auth_header", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WWW-Authenticate/Proxy-Authenticate header", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "soup_auth_update" soup_auth_update ::
Ptr Auth -> -- auth : TInterface (Name {namespace = "Soup", name = "Auth"})
Ptr Soup.Message.Message -> -- msg : TInterface (Name {namespace = "Soup", name = "Message"})
CString -> -- auth_header : TBasicType TUTF8
IO CInt
{- |
Updates /@auth@/ with the information from /@msg@/ and /@authHeader@/,
possibly un-authenticating it. As with 'GI.Soup.Objects.Auth.authNew', this is
normally only used by 'GI.Soup.Objects.Session.Session'.
-}
authUpdate ::
(B.CallStack.HasCallStack, MonadIO m, IsAuth a, Soup.Message.IsMessage b) =>
a
{- ^ /@auth@/: a 'GI.Soup.Objects.Auth.Auth' -}
-> b
{- ^ /@msg@/: the 'GI.Soup.Objects.Message.Message' /@auth@/ is being updated for -}
-> T.Text
{- ^ /@authHeader@/: the WWW-Authenticate\/Proxy-Authenticate header -}
-> m Bool
{- ^ __Returns:__ 'True' if /@auth@/ is still a valid (but potentially
unauthenticated) 'GI.Soup.Objects.Auth.Auth'. 'False' if something about /@authParams@/
could not be parsed or incorporated into /@auth@/ at all. -}
authUpdate auth msg authHeader = liftIO $ do
auth' <- unsafeManagedPtrCastPtr auth
msg' <- unsafeManagedPtrCastPtr msg
authHeader' <- textToCString authHeader
result <- soup_auth_update auth' msg' authHeader'
let result' = (/= 0) result
touchManagedPtr auth
touchManagedPtr msg
freeMem authHeader'
return result'
#if ENABLE_OVERLOADING
data AuthUpdateMethodInfo
instance (signature ~ (b -> T.Text -> m Bool), MonadIO m, IsAuth a, Soup.Message.IsMessage b) => O.MethodInfo AuthUpdateMethodInfo a signature where
overloadedMethod _ = authUpdate
#endif