3 Configuration and Client Persistence
The three modules described here allow the persistence of configuration between execution of tools or services using this package.
By default the files described below are stored in a directory ".oauth2.rkt" within the directory specified by find-system-path with the kind value 'home-dir.
3.1 Module oauth2/storage/config.
(require oauth2/storage/config) | package: simple-oauth2 |
This module provides a very simple get/put interface for configuration settings used by the package in general. The following table describes the currently used settings, with their types and default values.
key | type | default value |
'cipher-impl | '(aes gcm) | |
'cipher-key | generated | |
'cipher-iv | generated | |
'redirect-host-type | 'localhost | |
'redirect-host-port | 8080 | |
'redirect-path | "/oauth/authorization" | |
'redirect-ssl-certificate | #f | |
'redirect-ssl-key | #f |
The values for 'cipher-impl, 'cipher-key, and 'cipher-iv should not be modified by hand. The 'cipher-impl value determines which implementation is used to generate the 'cipher-key and 'cipher-iv which are used to encrypt/decrypt secrets in the clients and tokens files.
The values starting with 'redirect- represent the configuration for the internal web server required to host the OAuth redirect URI. The two SSL settings are paths to the corresponding files containing the certificate and key.
procedure
procedure
procedure
(get-preference key) → any/c
key : symbol?
procedure
(set-preference! key value) → void/c
key : symbol? value : any/c
procedure
procedure
3.2 Module oauth2/storage/clients.
(require oauth2/storage/clients) | package: simple-oauth2 |
This module provides a persistence layer for client configurations (see struct client?). The value for client-secret will be encryted during set-client! and decrypted during get-client and therefore will alway be stored in encrypted form.
procedure
(get-client service-name) → client?
service-name : string?
procedure
(set-client! a-client) → void/c
a-client : clientl?
procedure
(load-clients) → boolean?
procedure
(save-clients) → boolean?
3.3 Module oauth2/storage/tokens.
(require oauth2/storage/tokens) | package: simple-oauth2 |
This module provides a persistence layer for authentication tokens (see struct token?). The values for token-access-token and token-refresh-token will be encryted during set-token! and decrypted during get-token and therefore will alway be stored in encrypted form.
procedure
(get-services-for-user user-name) → (listof string?)
user-name : string?
procedure
(set-token! user-name service-name a-token) → void/c
user-name : string? service-name : string? a-token : token?
procedure
(load-tokens) → boolean?
procedure
(save-tokens) → boolean?