VAL
Virtuoso Authentication Layer
|
Functions | |
VAL.DBA.digest_authentication (varchar uname, varchar nonce, varchar pwdHash) | |
VAL.DBA.get_authentication_details_for_connection (varchar sid, varchar serviceId, varchar uname, int isRealUser, varchar realm=null, varchar sidParamName="sid", any cert, varchar webidGraph=null) | |
Checks for existing authentication information in the current connection. More... | |
VAL.DBA.logout (varchar sid=null, varchar sidParamName="sid") | |
Clear authentication information. More... | |
VAL.DBA.oauth_refresh_token (varchar service=null, varchar serviceId=null, int force=0, varchar oauthSid=null, varchar scope=null) | |
Refresh an OAuth access token based on service type and service id. More... | |
VAL.DBA.request_login_nonce () | |
VAL.DBA.thirdparty_authentication_url (varchar service, varchar data, varchar callback, varchar successProc=null, varchar errorProc=null, any params=null, varchar scope="basic", varchar clientIp=null, varchar realm=null) | |
Create an authentication URL for any supported 3rd-party service. More... | |
The VAL Authentication API provides a set of procedures to easily integrate authentication functionality into vsp pages.
VAL.DBA.digest_authentication | ( | varchar | uname, |
varchar | nonce, | ||
varchar | pwdHash | ||
) |
Perform digest authentication in a slightly more secure way than plain pwds. The pwdHash uses a nonce as generated via VAL.DBA.request_login_nonce() in combination with the password like so:
VAL_AUTH
. This means that applications running as a SQL user different from dba
can use the API by being granted the VAL_AUTH
role: VAL.DBA.get_authentication_details_for_connection | ( | varchar | sid, |
varchar | serviceId, | ||
varchar | uname, | ||
int | isRealUser, | ||
varchar | realm = null , |
||
varchar | sidParamName = "sid" , |
||
any | cert, | ||
varchar | webidGraph = null |
||
) |
Checks for existing authentication information in the current connection.
This procedure checks for authentication information like a session ID, a WebID client certificate, or basic HTTP authentication and fills the output parameters accordingly. The following authentication mechanisms are checked:
Afterwards the 3rd-party service ID or WebID is mapped to an existing SQL user account by the following means:
If successful the SPARQLUserId is set to the authenticated SQL user for the benetif of the SPARQL engine.
[out] | sid | Will be set to the session id if one has been found, null otherwise. Be aware that an empty session does not mean "no
authentication information". HTTP digest auth or WebID does not result in a session id. |
[out] | serviceId | Will be set to the 3rd-party serviceID connected to the session, the WebID embedded in the client certificate. If the session maps to an actual SQL user the serviceId will be set to their profile URI (VAL.DBA.user_personal_uri()). |
[out] | uname | Will be set to the SQL username if the authentication information could be mapped to one, null otherwise. |
[out] | isRealUser | Will be set to 1 if uname refers to an actual user, 0 if uname refers to a dummy SPARQL ACL rule user account which is only used for mapping. This is useful only for UIs which want to display the correct login identifier. If isRealUser is 1 then the UI should show that name, otherwise it should show the serviceID instead. |
[in,out] | realm | The optional application realm to be used. If provided only authentication information matching the realm will be returned. If null then the realm from the virtual directory will be used instead (see also Virtual Host Specific Realm). Should the realm not be set in the virtual dir options it will be set to the realm of the found authentication information, falling back to the default for authentication information without a realm. |
sidParamName | The name of the URL parameter and cookie used to store the session id. Default to sid . | |
[out] | cert | The optional client certificate which was used for authentication. Will be non-null for WebID and client cert authentication. Use this in calls to procedures like VAL.DBA.check_acls_for_resource() and friends. |
webidGraph | The optional graph URI to use for storing the WebID profile details. If null then a tmp graph will be created and cleared after the checks are finished. If the profile details are required after the authentication checks for something like authorization then providing a graph URI is a good idea. |
0
if no useful authentication information could be found, otherwise one of the following:1
- In case of authentication via a session id2
- In case of authentication via WebID or a client certificate3
- In case of HTTP authentication4
- In case of OAuth authenticationVAL_AUTH
. This means that applications running as a SQL user different from dba
can use the API by being granted the VAL_AUTH
role: VAL.DBA.logout | ( | varchar | sid = null , |
varchar | sidParamName = "sid" |
||
) |
Clear authentication information.
This procedure performs a full VAL logout: it invalidates the session, removes the session cookie and resets the SPARQLUserId.
If no session id is given it is determined using VAL.DBA.session_id_for_connection()
1
if logout was performed, 0
if no session id was found and nothing was done.VAL_AUTH
. This means that applications running as a SQL user different from dba
can use the API by being granted the VAL_AUTH
role: VAL.DBA.oauth_refresh_token | ( | varchar | service = null , |
varchar | serviceId = null , |
||
int | force = 0 , |
||
varchar | oauthSid = null , |
||
varchar | scope = null |
||
) |
Refresh an OAuth access token based on service type and service id.
service | The type of service. One of the supported types. See the ODS API documentation for details. |
serviceId | The service ID. In most cases this is a profile URI. See the ODS API documentation for details. |
force | If 1 the token will always be refreshed even if the expiration time is not reached yet. FIXME: does this at all make sense? If the token is revoken manually then we need to re-authenticate via UI anyway! |
oauthSid | Optional sid to identify the exact session to update. If this is null then the latest valid session is updated. |
scope | Optional Update the token with the given scope. Either 'profile' or 'basic'. Defaults to null in which case the first matching token is used, independant of its scope. |
VAL.DBA.request_login_nonce | ( | ) |
Public HTTP API method which allows clients such as authenticate.vsp to request a nonce for slightly safer digest login without https. The nonce will be tied to the client IP and can only be used once.
VAL_AUTH
. This means that applications running as a SQL user different from dba
can use the API by being granted the VAL_AUTH
role: VAL.DBA.thirdparty_authentication_url | ( | varchar | service, |
varchar | data, | ||
varchar | callback, | ||
varchar | successProc = null , |
||
varchar | errorProc = null , |
||
any | params = null , |
||
varchar | scope = "basic" , |
||
varchar | clientIp = null , |
||
varchar | realm = null |
||
) |
Create an authentication URL for any supported 3rd-party service.
The user should be directed to the returned URL to log into the service and approve the sharing of information.
service | The service to authenticate with. This can be any supported OAuth service or openid . See also Supported 3rd Party Services. |
data | Optional information required for login. Thus far only openid requires the actual OpenID URL. |
callback | The callback URL. Be aware that the third-party service will never see this URL since we use an internal callback URL which will handle the further processing based on the value of this URL and successProc . |
successProc | The name of a procedure to call for custom processing of the authentication data. Defaults to thirdparty_authentication_default_callback(). This procedure needs to return the final redirection URL based on the url parameter described below. The generic authentication callback procedure will, once authentication was successful, call this procedure with the following parameters:
|
errorProc | The name of a procedure to call in case of an error. Like successProc this procedure needs to return the redirection URL, however containing optional error information constructed from the parameters below. If not specified the plain url as provided in callback is used with additional parameter error.msg . Customizing this is typically not required. The procedure needs to handle the following parameters:
|
params | A vector of custom paramers which will be forwared to the callback procedure. This is a means to have state without persisting it. |
scope | The scope of the authentication. VAL currently supports three meta-scopes which are mapped to the service-dependent scope values if applicable. The scopes can also be combined by comma-separation.
|
clientIp | Force the IP address of the client to a different value. Some OAuth services enforce the client IP be the same for all steps but allow to set it once in the beginning. This is normally not required as it is figured out by default. However, if an ODS proxy is in use the automatically determined client IP will differ from the one of the client. In that case this should be set to the actual client which will also perform the authentication step with the 3rd party service. |
realm | The optional application realm in which authentication should be performed. This falls back to the default realm (VAL.DBA.get_default_realm()). |
VAL_AUTH
. This means that applications running as a SQL user different from dba
can use the API by being granted the VAL_AUTH
role: