Class Auth
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
Auth.Auth$Impl,AuthBasic,AuthDigest,AuthNegotiate,AuthNTLM
Specific HTTP Authentication mechanisms are implemented by its subclasses, but applications never need to be aware of the specific subclasses being used.
SoupAuth objects store the authentication data associated with a given bit
of web space. They are created automatically by Session.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe Auth$Impl type represents a native instance of the abstract Auth class.static classstatic classAuth.Builder<B extends Auth.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionAuth()Creates a new Auth.Auth(MemorySegment address) Create a Auth proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected AuthasParent()Returns this instance as if it were its parent type.voidauthenticate(String username, String password) Call this on an auth to authenticate it.booleanTests if this Auth is able to authenticate by providing credentials to theauthenticate(java.lang.String, java.lang.String).voidcancel()Call this on an auth to cancel it.voidfreeProtectionSpace(SList<MemorySegment> space) Freesspace.Returns the authority (host:port) that this Auth is associated with.getAuthorization(Message msg) Generates an appropriate "Authorization" header formsg.getInfo()Gets an opaque identifier forauth.static MemoryLayoutThe memory layout of the native struct.getProtectionSpace(Uri sourceUri) Returns a list of paths on the server which this Auth extends over.getRealm()Returnsauth'srealm.soup_auth_get_scheme_name: (attributes org.gtk.Method.get_property=scheme-name) Returnsauth'sscheme name.static @Nullable TypegetType()Get the GType of the Auth classbooleanTests if this Auth has been given a username and password.booleanTests if this Auth has been cancelledbooleanTests whether or not this Auth is associated with a proxy server rather than an "origin" server.booleanTests if this Auth is ready to make a request formsgwith.static AuthCreates a newSoupAuthof typetypewith the information frommsgandauthHeader.booleanUpdates this Auth with the information frommsgandauthHeader,possibly un-authenticating it.protected booleanupdate(Message msg, HashTable<MemorySegment, MemorySegment> authHeader) Updates this Auth with the information frommsgandauthHeader,possibly un-authenticating it.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, builder, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, 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, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Auth
Create a Auth proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Auth
public Auth()Creates a new Auth.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, 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. -
new_
Creates a newSoupAuthof typetypewith the information frommsgandauthHeader.This is called by
Session; you will normally not create auths yourself.- Parameters:
type- the type of auth to create (a subtype ofSoupAuth)msg- theSoupMessagethe auth is being created forauthHeader- the WWW-Authenticate/Proxy-Authenticate header
-
authenticate
Call this on an auth to authenticate it.Normally this will cause the auth's message to be requeued with the new authentication info.
- Parameters:
username- the username provided by the user or clientpassword- the password provided by the user or client
-
canAuthenticate
public boolean canAuthenticate()Tests if this Auth is able to authenticate by providing credentials to theauthenticate(java.lang.String, java.lang.String).- Returns:
trueif this Auth is able to accept credentials.
-
cancel
public void cancel()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 (
authenticate(java.lang.String, java.lang.String)is not called). TheSoupAuthwill be cancelled on dispose if it hans't been authenticated. -
freeProtectionSpace
Freesspace.- Parameters:
space- the return value fromgetProtectionSpace(org.gnome.glib.Uri)
-
getAuthority
Returns the authority (host:port) that this Auth is associated with.- Returns:
- the authority
-
getAuthorization
Generates an appropriate "Authorization" header formsg.(The session will only call this if
isAuthenticated()returnedtrue.)- Parameters:
msg- theSoupMessageto be authorized- Returns:
- the "Authorization" header, which must be freed.
-
getInfo
Gets an opaque identifier forauth.The identifier can be used as a hash key or the like.
SoupAuthobjects 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).- Returns:
- the identifier
-
getProtectionSpace
Returns a list of paths on the server which this Auth extends over.(All subdirectories of these paths are also assumed to be part of
auth'sprotection space, unless otherwise discovered not to be.)- Parameters:
sourceUri- the URI of the request that this Auth was generated in response to.- Returns:
- the list of
paths, which can be freed with
freeProtectionSpace(org.gnome.glib.SList<java.lang.foreign.MemorySegment>).
-
getRealm
Returnsauth'srealm.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.)
- Returns:
- the realm name
-
getSchemeName
soup_auth_get_scheme_name: (attributes org.gtk.Method.get_property=scheme-name) Returnsauth'sscheme name. (Eg, "Basic", "Digest", or "NTLM")- Returns:
- the scheme name
-
isAuthenticated
public boolean isAuthenticated()Tests if this Auth has been given a username and password.- Returns:
trueif this Auth has been given a username and password
-
isCancelled
public boolean isCancelled()Tests if this Auth has been cancelled- Returns:
trueif this Auth has been cancelled
-
isForProxy
public boolean isForProxy()Tests whether or not this Auth is associated with a proxy server rather than an "origin" server.- Returns:
trueorfalse
-
isReady
Tests if this Auth is ready to make a request formsgwith.For most auths, this is equivalent to
isAuthenticated(), but for some auth types (eg, NTLM), the auth may be sendable (eg, as an authentication request) even before it is authenticated.- Parameters:
msg- aSoupMessage- Returns:
trueif this Auth is ready to make a request with.
-
update
Updates this Auth with the information frommsgandauthHeader,possibly un-authenticating it.- Parameters:
msg- theSoupMessagethis Auth is being updated forauthHeader- the WWW-Authenticate/Proxy-Authenticate header- Returns:
trueif this Auth is still a valid (but potentially unauthenticated)SoupAuth.falseif something aboutauthParamscould not be parsed or incorporated into this Auth at all.
-
update
Updates this Auth with the information frommsgandauthHeader,possibly un-authenticating it.- Parameters:
msg- theSoupMessagethis Auth is being updated forauthHeader- the WWW-Authenticate/Proxy-Authenticate header- Returns:
trueif this Auth is still a valid (but potentially unauthenticated)SoupAuth.falseif something aboutauthParamscould not be parsed or incorporated into this Auth at all.
-