Class AuthenticationRequest
- All Implemented Interfaces:
Proxy
Whenever a client attempts to load a page protected by HTTP
authentication, credentials will need to be provided to authorize access.
To allow the client to decide how it wishes to handle authentication,
WebKit will fire a WebKitWebView
::authenticate signal with a
WebKitAuthenticationRequest object to provide client side
authentication support. Credentials are exposed through the
WebKitCredential
object.
In case the client application does not wish to handle this signal WebKit will provide a default handler. To handle authentication asynchronously, simply increase the reference count of the WebKitAuthenticationRequest object.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Functional interface declaration of theAuthenticatedCallback
callback.static class
static class
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theCancelledCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionAuthenticationRequest
(MemorySegment address) Create a AuthenticationRequest proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected AuthenticationRequest
asParent()
Returns this instance as if it were its parent type.void
authenticate
(@Nullable Credential credential) Authenticate theWebKitAuthenticationRequest
.static AuthenticationRequest.Builder
<? extends AuthenticationRequest.Builder> builder()
AAuthenticationRequest.Builder
object constructs aAuthenticationRequest
with the specified properties.void
cancel()
Cancel the authentication challenge.boolean
Determine whether thisWebKitAuthenticationRequest
should allow the storage of credentials.void
emitAuthenticated
(Credential credential) Emits the "authenticated" signal.void
Emits the "cancelled" signal.Get theGTlsPasswordFlags
of theAuthenticationScheme.CLIENT_CERTIFICATE_PIN_REQUESTED
authentication challenge.getHost()
Get the host that this authentication challenge is applicable to.int
getPort()
Get the port that this authentication challenge is applicable to.Get theWebKitCredential
of the proposed authentication challenge.getRealm()
Get the realm that this authentication challenge is applicable to.Get the authentication scheme of the authentication challenge.Get theWebKitSecurityOrigin
that this authentication challenge is applicable to.static Type
getType()
Get the GType of the AuthenticationRequest classboolean
Determine whether the authentication challenge is associated with a proxy server.boolean
isRetry()
Determine whether this this is a first attempt or a retry for this authentication challenge.This signal is emitted when the user authentication request succeeded.This signal is emitted when the user authentication request is cancelled.void
setCanSaveCredentials
(boolean enabled) Set whether the authentication method associated with this AuthenticationRequest should allow the storage of credentials.void
setProposedCredential
(Credential credential) Set theWebKitCredential
of the proposed authentication challenge.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
AuthenticationRequest
Create a AuthenticationRequest proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
authenticate
Authenticate theWebKitAuthenticationRequest
.Authenticate the
WebKitAuthenticationRequest
using theWebKitCredential
supplied. To continue without credentials, passnull
ascredential
.- Parameters:
credential
- AWebKitCredential
, ornull
-
canSaveCredentials
public boolean canSaveCredentials()Determine whether thisWebKitAuthenticationRequest
should allow the storage of credentials.Determine whether the authentication method associated with this
WebKitAuthenticationRequest
should allow the storage of credentials. This will returnfalse
if WebKit doesn't support credential storing, if private browsing is enabled, or if persistent credential storage has been disabled inWebKitWebsiteDataManager
, unless credentials saving has been explicitly enabled with webkit_authentication_request_set_can_save_credentials().- Returns:
true
if WebKit can store credentials orfalse
otherwise.
-
cancel
public void cancel()Cancel the authentication challenge.This will also cancel the page loading and result in a
WebKitWebView
::load-failed signal with aWebKitNetworkError
of typeNetworkError.CANCELLED
being emitted. -
getCertificatePinFlags
Get theGTlsPasswordFlags
of theAuthenticationScheme.CLIENT_CERTIFICATE_PIN_REQUESTED
authentication challenge.- Returns:
- a
GTlsPasswordFlags
-
getHost
Get the host that this authentication challenge is applicable to.- Returns:
- The host of this AuthenticationRequest.
-
getPort
public int getPort()Get the port that this authentication challenge is applicable to.- Returns:
- The port of this AuthenticationRequest.
-
getProposedCredential
Get theWebKitCredential
of the proposed authentication challenge.Get the
WebKitCredential
of the proposed authentication challenge that was stored from a previous session. The client can use this directly for authentication or construct their ownWebKitCredential
.- Returns:
- A
WebKitCredential
encapsulating credential details ornull
if there is no stored credential.
-
getRealm
Get the realm that this authentication challenge is applicable to.- Returns:
- The realm of this AuthenticationRequest.
-
getScheme
Get the authentication scheme of the authentication challenge.- Returns:
- The
WebKitAuthenticationScheme
of this AuthenticationRequest.
-
getSecurityOrigin
Get theWebKitSecurityOrigin
that this authentication challenge is applicable to.- Returns:
- a newly created
WebKitSecurityOrigin
.
-
isForProxy
public boolean isForProxy()Determine whether the authentication challenge is associated with a proxy server.Determine whether the authentication challenge is associated with a proxy server rather than an "origin" server.
- Returns:
true
if authentication is for a proxy orfalse
otherwise.
-
isRetry
public boolean isRetry()Determine whether this this is a first attempt or a retry for this authentication challenge.- Returns:
true
if authentication attempt is a retry orfalse
otherwise.
-
setCanSaveCredentials
public void setCanSaveCredentials(boolean enabled) Set whether the authentication method associated with this AuthenticationRequest should allow the storage of credentials.Set whether the authentication method associated with this AuthenticationRequest should allow the storage of credentials. This should be used by applications handling their own credentials storage to indicate that it should be supported even when internal credential storage is disabled or unsupported. Note that storing of credentials will not be allowed on ephemeral sessions in any case.
- Parameters:
enabled
- value to set
-
setProposedCredential
Set theWebKitCredential
of the proposed authentication challenge.Set the
WebKitCredential
of the proposed authentication challenge that was stored from a previous session. This should only be used by applications handling their own credential storage. (When using the default WebKit credential storage, webkit_authentication_request_get_proposed_credential() already contains previously-stored credentials.) Passing anull
credential
will clear the proposed credential.- Parameters:
credential
- aWebKitCredential
, ornull
-
onAuthenticated
public SignalConnection<AuthenticationRequest.AuthenticatedCallback> onAuthenticated(AuthenticationRequest.AuthenticatedCallback handler) This signal is emitted when the user authentication request succeeded. Applications handling their own credential storage should connect to this signal to save the credentials.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitAuthenticated
Emits the "authenticated" signal. SeeonAuthenticated(org.gnome.webkit.AuthenticationRequest.AuthenticatedCallback)
. -
onCancelled
public SignalConnection<AuthenticationRequest.CancelledCallback> onCancelled(AuthenticationRequest.CancelledCallback handler) This signal is emitted when the user authentication request is cancelled. It allows the application to dismiss its authentication dialog in case of page load failure for example.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitCancelled
public void emitCancelled()Emits the "cancelled" signal. SeeonCancelled(org.gnome.webkit.AuthenticationRequest.CancelledCallback)
. -
builder
AAuthenticationRequest.Builder
object constructs aAuthenticationRequest
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withAuthenticationRequest.Builder.build()
.
-