gi-soup-2.4.24: Libsoup bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Soup.Objects.HSTSEnforcer

Description

A HSTSEnforcer stores HSTS policies and enforces them when required. HSTSEnforcer implements SessionFeature, so you can add an HSTS enforcer to a session with sessionAddFeature or sessionAddFeatureByType.

HSTSEnforcer keeps track of all the HTTPS destinations that, when connected to, return the Strict-Transport-Security header with valid values. HSTSEnforcer will forget those destinations upon expiry or when the server requests it.

When the Session the HSTSEnforcer is attached to queues or restarts a message, the HSTSEnforcer will rewrite the URI to HTTPS if the destination is a known HSTS host and is contacted over an insecure transport protocol (HTTP). Users of HSTSEnforcer are advised to listen to changes in SoupMessage:uri in order to be aware of changes in the message URI.

Note that HSTSEnforcer does not support any form of long-term HSTS policy persistence. See SoupHSTSDBEnforcer for a persistent enforcer.

Synopsis

Exported types

newtype HSTSEnforcer Source #

Memory-managed wrapper type.

Constructors

HSTSEnforcer (ManagedPtr HSTSEnforcer) 

Instances

Instances details
Eq HSTSEnforcer Source # 
Instance details

Defined in GI.Soup.Objects.HSTSEnforcer

GObject HSTSEnforcer Source # 
Instance details

Defined in GI.Soup.Objects.HSTSEnforcer

ManagedPtrNewtype HSTSEnforcer Source # 
Instance details

Defined in GI.Soup.Objects.HSTSEnforcer

Methods

toManagedPtr :: HSTSEnforcer -> ManagedPtr HSTSEnforcer

TypedObject HSTSEnforcer Source # 
Instance details

Defined in GI.Soup.Objects.HSTSEnforcer

Methods

glibType :: IO GType

HasParentTypes HSTSEnforcer Source # 
Instance details

Defined in GI.Soup.Objects.HSTSEnforcer

IsGValue (Maybe HSTSEnforcer) Source #

Convert HSTSEnforcer to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Soup.Objects.HSTSEnforcer

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe HSTSEnforcer -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe HSTSEnforcer)

type ParentTypes HSTSEnforcer Source # 
Instance details

Defined in GI.Soup.Objects.HSTSEnforcer

type ParentTypes HSTSEnforcer = '[Object, SessionFeature]

class (GObject o, IsDescendantOf HSTSEnforcer o) => IsHSTSEnforcer o Source #

Type class for types which can be safely cast to HSTSEnforcer, for instance with toHSTSEnforcer.

Instances

Instances details
(GObject o, IsDescendantOf HSTSEnforcer o) => IsHSTSEnforcer o Source # 
Instance details

Defined in GI.Soup.Objects.HSTSEnforcer

toHSTSEnforcer :: (MonadIO m, IsHSTSEnforcer o) => o -> m HSTSEnforcer Source #

Cast to HSTSEnforcer, for types for which this is known to be safe. For general casts, use castTo.

Methods

getDomains

hSTSEnforcerGetDomains Source #

Arguments

:: (HasCallStack, MonadIO m, IsHSTSEnforcer a) 
=> a

hstsEnforcer: a HSTSEnforcer

-> Bool

sessionPolicies: whether to include session policies

-> m [Text]

Returns: a newly allocated list of domains. Use g_list_free_full() and free to free the list.

Gets a list of domains for which there are policies in enforcer.

Since: 2.68

getPolicies

hSTSEnforcerGetPolicies Source #

Arguments

:: (HasCallStack, MonadIO m, IsHSTSEnforcer a) 
=> a

hstsEnforcer: a HSTSEnforcer

-> Bool

sessionPolicies: whether to include session policies

-> m [HSTSPolicy]

Returns: a newly allocated list of policies. Use g_list_free_full() and hSTSPolicyFree to free the list.

Gets a list with the policies in enforcer.

Since: 2.68

hasValidPolicy

hSTSEnforcerHasValidPolicy Source #

Arguments

:: (HasCallStack, MonadIO m, IsHSTSEnforcer a) 
=> a

hstsEnforcer: a HSTSEnforcer

-> Text

domain: a domain.

-> m Bool

Returns: True if access to domain should happen over HTTPS, false otherwise.

Gets whether hstsEnforcer has a currently valid policy for domain.

Since: 2.68

isPersistent

hSTSEnforcerIsPersistent Source #

Arguments

:: (HasCallStack, MonadIO m, IsHSTSEnforcer a) 
=> a

hstsEnforcer: a HSTSEnforcer

-> m Bool

Returns: True if hstsEnforcer storage is persistent or False otherwise.

Gets whether hstsEnforcer stores policies persistenly.

Since: 2.68

new

hSTSEnforcerNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m HSTSEnforcer

Returns: a new HSTSEnforcer

Creates a new HSTSEnforcer. The base HSTSEnforcer class does not support persistent storage of HSTS policies, see HSTSEnforcerDB for that.

Since: 2.68

setPolicy

hSTSEnforcerSetPolicy Source #

Arguments

:: (HasCallStack, MonadIO m, IsHSTSEnforcer a) 
=> a

hstsEnforcer: a HSTSEnforcer

-> HSTSPolicy

policy: the policy of the HSTS host

-> m () 

Sets policy to hstsEnforcer. If policy is expired, any existing HSTS policy for its host will be removed instead. If a policy existed for this host, it will be replaced. Otherwise, the new policy will be inserted. If the policy is a session policy, that is, one created with hSTSPolicyNewSessionPolicy, the policy will not expire and will be enforced during the lifetime of hstsEnforcer's Session.

Since: 2.68

setSessionPolicy

hSTSEnforcerSetSessionPolicy Source #

Arguments

:: (HasCallStack, MonadIO m, IsHSTSEnforcer a) 
=> a

hstsEnforcer: a HSTSEnforcer

-> Text

domain: policy domain or hostname

-> Bool

includeSubdomains: True if the policy applies on sub domains

-> m () 

Sets a session policy for domain. A session policy is a policy that is permanent to the lifetime of hstsEnforcer's Session and doesn't expire.

Since: 2.68

Signals

changed

type C_HSTSEnforcerChangedCallback = Ptr () -> Ptr HSTSPolicy -> Ptr HSTSPolicy -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type HSTSEnforcerChangedCallback Source #

Arguments

 = HSTSPolicy

oldPolicy: the old HSTSPolicy value

-> HSTSPolicy

newPolicy: the new HSTSPolicy value

-> IO () 

Emitted when hstsEnforcer changes. If a policy has been added, newPolicy will contain the newly-added policy and oldPolicy will be Nothing. If a policy has been deleted, oldPolicy will contain the to-be-deleted policy and newPolicy will be Nothing. If a policy has been changed, oldPolicy will contain its old value, and newPolicy its new value.

Note that you shouldn't modify the policies from a callback to this signal.

afterHSTSEnforcerChanged :: (IsHSTSEnforcer a, MonadIO m) => a -> HSTSEnforcerChangedCallback -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after hSTSEnforcer #changed callback

onHSTSEnforcerChanged :: (IsHSTSEnforcer a, MonadIO m) => a -> HSTSEnforcerChangedCallback -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on hSTSEnforcer #changed callback

hstsEnforced

type C_HSTSEnforcerHstsEnforcedCallback = Ptr () -> Ptr Message -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type HSTSEnforcerHstsEnforcedCallback Source #

Arguments

 = Message

message: the message for which HSTS is being enforced

-> IO () 

Emitted when hstsEnforcer has upgraded the protocol for message to HTTPS as a result of matching its domain with a HSTS policy.

afterHSTSEnforcerHstsEnforced :: (IsHSTSEnforcer a, MonadIO m) => a -> HSTSEnforcerHstsEnforcedCallback -> m SignalHandlerId Source #

Connect a signal handler for the hstsEnforced signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after hSTSEnforcer #hstsEnforced callback

onHSTSEnforcerHstsEnforced :: (IsHSTSEnforcer a, MonadIO m) => a -> HSTSEnforcerHstsEnforcedCallback -> m SignalHandlerId Source #

Connect a signal handler for the hstsEnforced signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on hSTSEnforcer #hstsEnforced callback