@@ -1120,7 +1120,8 @@ handle `HTTP_STATUS_UNAUTHORIZED` responses beyond simply calling
11201120
11211121# # Authentication Using Passwords
11221122
1123- When you call [`cupsDoAuthentication`](@@), CUPS normally requests a password
1123+ When you call [`cupsDoAuthentication`](@@) and the HTTP server requires the
1124+ " Basic" or "Digest" authentication schemes, CUPS normally requests a password
11241125from the console. GUI applications should set a password callback using the
11251126[`cupsSetPasswordCB`](@@) function :
11261127
@@ -1149,16 +1150,50 @@ authenticated. The password callback can call the [`httpGetField`](@@) and
11491150authentication challenge.
11501151
11511152The "method" argument specifies the HTTP method used for the request and is
1152- typically "POST".
1153+ typically "GET", " POST", or "PUT ".
11531154
1154- The "resource" argument specifies the path used for the request.
1155+ The "resource" argument specifies the path or URI used for the request.
11551156
1156- The "cb_data" argument provides the user data pointer from the
1157+ The "cb_data" argument provides the data pointer from the
11571158[`cupsSetPasswordCB`](@@) call.
11581159
11591160
11601161# # Authorization using OAuth/OpenID Connect
11611162
1163+ When you call [`cupsDoAuthentication`](@@) and the HTTP server requires the
1164+ " Bearer" authentication scheme, CUPS will call an OAuth callback that you
1165+ register using the [`cupsSetOAuthCB`](@@) function :
1166+
1167+ ` ` ` c
1168+ void
1169+ cupsSetOAuthCB(cups_oauth_cb_t cb, void *cb_data);
1170+ ` ` `
1171+
1172+ The OAuth callback is called when needed and is responsible for performing any
1173+ necessary authorization and returning an access token string :
1174+
1175+ ` ` ` c
1176+ const char *
1177+ cups_oauth_cb(http_t *http, const char *realm, const char *scope,
1178+ const char *resource, void *cb_data);
1179+ ` ` `
1180+
1181+ The "http" argument is the connection hosting the request that is being
1182+ authenticated. The OAuth callback can call the [`httpGetField`](@@) and
1183+ [`httpGetSubField`](@@) functions to look for additional details concerning the
1184+ authentication challenge.
1185+
1186+ The "realm" and "scope" arguments provide the "realm" and "scope" parameters, if
1187+ any, from the "WWW-Authenticate" header.
1188+
1189+ The "resource" argument specifies the path or URI used for the request.
1190+
1191+ The "cb_data" argument provides the data pointer from the
1192+ [`cupsSetOAuthCB`](@@) call.
1193+
1194+
1195+ # ## OAuth Client Functions
1196+
11621197CUPS provides a generic OAuth/OpenID client for authorizing access to printers
11631198and other network resources. The following functions are provided :
11641199
@@ -1244,6 +1279,7 @@ if (access_token == NULL)
12441279
12451280// Set the Bearer token for authorization.
12461281httpSetAuthString(http, "Bearer", access_token);
1282+ free(access_token);
12471283` ` `
12481284
12491285
@@ -1321,6 +1357,7 @@ if (access_token == NULL)
13211357
13221358// Set the Bearer token for authorization.
13231359httpSetAuthString(http, "Bearer", access_token);
1360+ free(access_token);
13241361` ` `
13251362
13261363
0 commit comments