config.pl -- Make HTTP locations known to JSON code
- swish_reply_config(+Request, +Options) is semidet
- Emit a configuration object to the client if the client requests for '.../swish_config.json', regardless of the path prefix.
- swish_config_hash(-Hash, +Options) is det
- True if Hash is the SHA1 of the SWISH config.
- config(-Key, -Value) is nondet[multifile]
- swish_config(-Key, -Value) is nondet[multifile]
- Define a name/value pair that will end up in the SWISH config
object (see
web/js/config.js
) - login_item(-Server, -Item) is nondet[multifile]
- This hook is called to find all possible login options. It
should bind Item to an HTML description for html//1 that must be
clicked to login with this option. The item may have the
following HTML attributes:
- data-server(+Server)
- This must be present and provides the first argument for the login/2 hook.
- data-frame(+Style)
- The login is realised in a popup to avoid reloading the
current swish page. If Style is
popup
, a browser popup window is used. This is necessary for identity providers that refuse to open inside a frame. The default isiframe
, which handles the login inside aniframe
element in a modal popup.
The Item is often an image. The image must have a class
login-with
. Below is an example to login with Google:swish_config:login_item(Item) :- http_absolute_location(icons('social_google_box.png'), Img, []), Item = img([ src(Img), class('login-with'), 'data-server'(google), title('Login with Google') ]).
- login(+Server, +Request) is det[multifile]
- If a login item with
'data-server'(+Server)
is clicked, the HTTP handler with idlogin
is called. This handler figures the selected login server and calls this hook. - user_info(+Request, -Server, -UserInfo:dict) is semidet[multifile]
- Each login facility must provide this hook. The hook should
succeed if-and-only-if the user is logged in using this facility
and the hook must bind UserInfo with a dict that contains the
following fields:
- user:User
- User name (id) if the logged in user.
- name:Name
- Common name of the logged in user.
- email:Email
- Email address of the logged in user.
- picture:URL
- If present, URL is used to indicate the currently logged in user.
- auth_method:Method
- Authentication method used. Currently one of
basic
,digest
oroauth2
. - logout_url:URL
- URL that must be used to logout. Needed if
auth_method
is not one of the HTTP authentication methods (basic
ordigest
).
If this hook fails the user is not logged in.
- source_alias(?Alias, ?Options) is nondet[multifile]
- Multifile hook that defines properties of file_search_path/2
aliases wrt. storage handling. Defined options are:
- access(Access)
- One of
read
orboth
. - search(Pattern)
- The New Tab search form searches in files that satisfy the given pattern in the matching directories. Pattern is handed to expand_file_name/2.
Re-exported predicates
The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.
- config(-Key, -Value) is nondet
- swish_config(-Key, -Value) is nondet
- Define a name/value pair that will end up in the SWISH config
object (see
web/js/config.js
)