You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[.z.c cores](#zc-cores)[.z.exit action on exit](#zexit-action-on-exit)
18
18
[.z.D/d date shortcuts](#zt-zt-zd-zd-timedate-shortcuts)[.z.pc close](#zpc-close)
@@ -83,33 +83,35 @@ q)"i"$0x0 vs .z.a
83
83
When invoked via a Unix Domain Socket, it is 0.
84
84
85
85
86
-
## `.z.ac` (HTTP auth from cookie)
86
+
## `.z.ac` (HTTP auth)
87
87
88
88
```syntax
89
89
.z.ac:(requestText;requestHeaderAsDictionary)
90
90
```
91
91
92
-
Lets you define custom code to extract Single Sign On (SSO) token cookies from the HTTP header and verify it, decoding and returning the username, or instructing what action to take.
92
+
Lets you define custom code to authorize/authenticate an HTTP request.
93
+
e.g. inspect HTTP headers representing oauth tokens, cookies, etc.
94
+
Your custom code can then return different values based on what is discovered.
93
95
96
+
The function should return a two-element list. The list of possible return values is:
97
+
98
+
* User not authorized/authenticated
94
99
```q
95
-
q).z.ac:{mySSOAuthenticator x[1]`Authorization}
100
+
(0;"")
96
101
```
97
-
98
-
where allowed return values are
99
-
102
+
User not authorized. Client is sent default 401 HTTP unauthorized response.
103
+
An HTTP callback to handle the request will not be called.
(2;"response text") / send raw response text to client
104
-
(4;"") / fallback to try authentication via .z.pw (V4.0 2021.07.12)
106
+
(1;"username")
105
107
```
108
+
The provided username is used to set [`.z.u`](#zu-user-id).
109
+
The relevant HTTP callback to handle this request will be allowed.
110
+
* User not authorized/authenticated (custom response)
111
+
```q
112
+
(2;"response text")
106
113
107
-
and `mySSOAuthenticator` is your custom code that authenticates against your SSO library.
108
-
109
-
If `.z.ac` returns `(4;"")` then `.z.pw` will be called with the b64-decoded credentials from the http header when .z.ac returns (4;"").
110
-
111
-
:fontawesome-solid-hand-point-right:
112
-
[`.z.pw` password check](#zpw-validate-user)
114
+
!!! note "If .z.ac is not defined, it uses basic access authentication as per `(4;"")` above"
113
115
114
116
115
117
## `.z.b` (dependencies)
@@ -643,7 +645,7 @@ For the POST method use [.z.pp](#zpp-http-post), and for GET use [.z.ph](#zph-ht
643
645
.z.po:f
644
646
```
645
647
646
-
Where `f` is a unary function, `.z.po` is evaluated when a connection to a kdb+ session has been initialized, i.e. after it’s been validated against any `-u/-U` file and `.z.pw` checks.
648
+
Where `f` is a unary function, `.z.po` is evaluated when a connection to a kdb+ session has been initialized, i.e. after it’s been validated against any [`-u`](../basics/cmdline.md#-u-usr-pwd-local)/[`-U`](../basics/cmdline.md#-u-usr-pwd) file and `.z.pw` checks.
647
649
648
650
Its argument is the handle and is typically used to build a dictionary of handles to session information like the value of `.z.a`, `.z.u`
649
651
@@ -724,7 +726,7 @@ q)0 "2+2"
724
726
.z.pw:f
725
727
```
726
728
727
-
Where `f` is a binary function, `.z.pw` is evaluated _after_ the `-u/-U` checks, and _before_`.z.po` when opening a new connection to a kdb+ session.
729
+
Where `f` is a binary function, `.z.pw` is evaluated _after_ the [`-u`](../basics/cmdline.md#-u-usr-pwd-local)/[`-U`](../basics/cmdline.md#-u-usr-pwd) checks, and _before_`.z.po` when opening a new connection to a kdb+ session.
728
730
729
731
The arguments are the user ID (as a symbol) and password (as a string) to be verified; the result is a boolean atom.
0 commit comments