CEF and AuthServerAllowlist, AuthSchemes

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Re: CEF and AuthServerAllowlist, AuthSchemes

Postby digory » Mon Apr 11, 2022 4:31 am

Setting auth.schemes and auth.server_whitelist doesn't seem to work. If I have a CefRefPtr<CefRequestContext> reqCtx and call reqCtx->CanSetPreference("auth"), I get false as a result. Meaning I can't set the auth prefs.

I don't set the prefs in OnContextInitialized (or did you mean OnContextCreated in the render process?). I set it earlier when calling CefBrowserHost::CreateBrowser; CreateBrowser has an argument where I can pass the modified request context. This works for the proxy preference, by the way.

What happens if I retrieve the "auth" prefs dictionary with GetPreference and modify it? Does CEF/Chromium see the modified dictionary if I don't call SetPreference at all?
digory
Expert
 
Posts: 118
Joined: Wed Oct 26, 2016 3:13 am

Re: CEF and AuthServerAllowlist, AuthSchemes

Postby amaitland » Mon Apr 11, 2022 8:29 pm

No I mean OnContextInitialized which is the earliest place you can access the Global Request Context.

https://github.com/chromiumembedded/cef ... dler.h#L58

You cannot set the `auth` preference as it's a top level node. So returning false is expected there.

Trying to set auth.schemes or auth.server_whitelist returns "Trying to modify an unregistered preference". So CEF would require changes for either of those to work unfortunately.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: CEF and AuthServerAllowlist, AuthSchemes

Postby digory » Tue Apr 12, 2022 1:31 am

You cannot set the `auth` preference as it's a top level node. So returning false is expected there.


Seems I haven't understood the concept of the preferences, then. Interestingly, it works fine for the proxy preference. I retrieve the existing proxy preference via GetPreference("proxy")->GetDictionary(), then I modify the dictionary and put it back with SetPreference("proxy", dict, err). SetPreference returns true, and the proxy settings seem to work. However, "proxy" is also a top-level node, right? How am I supposed to change a leaf node if not like this?

Trying to set auth.schemes or auth.server_whitelist returns "Trying to modify an unregistered preference". So CEF would require changes for either of those to work unfortunately.


Does that mean that the whole approach via preference is not going to work anyway for the auth keys?
digory
Expert
 
Posts: 118
Joined: Wed Oct 26, 2016 3:13 am

Re: CEF and AuthServerAllowlist, AuthSchemes

Postby amaitland » Tue Apr 12, 2022 4:18 am

Over simplification on my part. webkit, intl, auth etc should return false for can set.

The easiest way to is simply use the key string with dot notation, e.g. webkit.webprefs.minimum_font_size

One of my favorite examples, try setting it to say 24.

Looks like CEF will need changes to support those prefs.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: CEF and AuthServerAllowlist, AuthSchemes

Postby j3s » Thu Sep 07, 2023 1:58 am

Just in case someone stubmles upon this:
"auth.server_whitelist" does not to be viable anymore - I switched to "auth-server-allowlist" (the original poster did correctly mention "AuthServerAllowlist")

See: https://peter.sh/experiments/chromium-c ... -switches/ which is referenced by https://www.chromium.org/developers/how ... ith-flags/

Using this code:
settings.CefCommandLineArgs.Add("auth-server-allowlist", server);
j3s
Newbie
 
Posts: 9
Joined: Sun Apr 23, 2023 4:41 am

Previous

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 198 guests