]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add default client ID for MS Entrada ID.
authorMichael R Sweet <msweet@msweet.org>
Mon, 14 Apr 2025 23:43:44 +0000 (19:43 -0400)
committerMichael R Sweet <msweet@msweet.org>
Mon, 14 Apr 2025 23:43:44 +0000 (19:43 -0400)
cups/oauth.c

index a1e49957df52d7fd7c3667a5f418da57264a91d4..b7f426fb6675bf9487d180b4c807a2f034a994f4 100644 (file)
@@ -110,6 +110,13 @@ typedef enum _cups_otype_e         // OAuth data type
 // Local constants...
 //
 
+#define _CUPS_CONNECTOR_CLIENT_ID      "a92130af-5eac-4a8a-8ba3-e17276b52ca1"
+                                       // CUPS Universal Print Connector client ID
+#define _CUPS_CONNECTOR_OAUTH_URI      "https://login.microsoftonline.com/"
+                                       // OAuth URI prefix for MS Entrada ID
+#define _CUPS_CONNECTOR_OAUTH_URILEN   34
+                                       // Length of OAuth URI prefix
+
 #define _CUPS_OAUTH_REDIRECT_FORMAT    "http://127.0.0.1:%d/"
                                        // Redirect URI with port
 #define _CUPS_OAUTH_REDIRECT_PATH      "/?"
@@ -235,7 +242,16 @@ cupsOAuthCopyClientId(
     const char *auth_uri,              // I - Authorization Server URI
     const char *redirect_uri)          // I - Redirection URI
 {
-  return (oauth_load_value(auth_uri, redirect_uri, _CUPS_OTYPE_CLIENT_ID));
+  char *client_id;                     // Client ID value
+
+
+  if ((client_id = oauth_load_value(auth_uri, redirect_uri, _CUPS_OTYPE_CLIENT_ID)) == NULL && !strncmp(auth_uri, _CUPS_CONNECTOR_OAUTH_URI, _CUPS_CONNECTOR_OAUTH_URILEN))
+  {
+    // Use the default CUPS Universal Print connector client ID with MS Entrada ID...
+    client_id = strdup(_CUPS_CONNECTOR_CLIENT_ID);
+  }
+
+  return (client_id);
 }