Philipp Trulson created SOLR-18322:
--------------------------------------

             Summary: JWTAuthPlugin Admin UI login requests undocumented 
hardcoded solr scope
                 Key: SOLR-18322
                 URL: https://issues.apache.org/jira/browse/SOLR-18322
             Project: Solr
          Issue Type: Bug
          Components: Authentication
    Affects Versions: 10.0
            Reporter: Philipp Trulson


With {{JWTAuthPlugin}} (directly or via {{{}MultiAuthPlugin{}}}) configured 
with only {{wellKnownUrl}} + {{clientId}} and no 
{{{}scope{}}}/{{{}adminUiScope{}}}, the Admin UI login redirects to the IdP 
with {{{}scope=openid solr{}}}. The {{solr}} value is a hardcoded fallback:

{{// 
[JWTAuthPlugin.java|https://github.com/apache/solr/blob/main/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTAuthPlugin.java#L252-L256]}}
{{if (adminUiScope == null) {}}
{{  adminUiScope = "solr";}}
{{  log.info("No adminUiScope provided, fallback to 'solr' as required scope 
for Admin UI login may not work");}}
{{}}}

and {{login.js}} builds {{{}"scope": "openid " + adminUiScope{}}}.

Of course by default OIDC providers (in this case Keycloak) have no {{solr}} 
scope, so the authorize request fails with {{invalid_scope}} ("Invalid scopes: 
openid solr"). Login is impossible until one discovers they must set 
{{adminUiScope}} to a pre-existing scope such as {{{}profile{}}}.

In my eyes the main issue are the docs here citing
{quote}adminUiScope: Define what scope is requested when logging in from Admin 
UI
Default: If not defined, the first scope from scope parameter is used

scope: Whitespace separated list of valid scopes. If configured, the JWT access 
token MUST contain a scope claim with at least one of the listed scopes. 
Example: solr:read solr:admin
Default: _null or  "" (not clear because the cell is just empty)_
{quote}
So I'd suggest either adding more info to the documentation or setting a more 
sane default that works out-of-the-box with most OIDC providers.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to