quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.87k stars 2.71k forks source link

Docs: Dev Services and UI for OpenID Connect discrepancies #37666

Open michalvavrik opened 11 months ago

michalvavrik commented 11 months ago

Describe the bug

I read https://quarkus.io/version/main/guides/security-openid-connect-dev-services and saw few discrepancies:

https://github.com/quarkusio/quarkus/blob/9d9cb794218b61b1213dae3c43176c0cb6d99250/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/OidcDevUIProcessor.java#L115

I can see it is default, but looking at

https://github.com/quarkusio/quarkus/blob/9d9cb794218b61b1213dae3c43176c0cb6d99250/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/keycloak/KeycloakDevUIProcessor.java#L56

I'm not sure what the default is there. If indeed code is default, then shouldn't it be documented somewhere else as well?

...
2021-07-19 17:58:11,407 INFO  [io.qua.oid.dep.dev.key.KeycloakDevConsolePostHandler] (security-openid-connect-quickstart-dev.jar) (DEV Console action) Using password grant to get a token from 'http://localhost:32818/realms/quarkus/protocol/openid-connect/token' for user 'alice' in realm 'quarkus' with client id 'quarkus-app'
...

but these messages are now logged by io.quarkus.oidc.runtime.devui.OidcDevServicesUtils

Expected behavior

Consider discrepancies.

Actual behavior

See issue description.

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

quarkus-bot[bot] commented 11 months ago

/cc @geoand (devservices), @stuartwdouglas (devservices)

sberyozkin commented 11 months ago

@michalvavrik The log output is now collapsed once the container has started, so that output is there initially but unfortunately hard to see

sberyozkin commented 11 months ago

As far as the code grant is concerned, keycloak dev service specific property has been deprecated so the code allows to use another property such that if someone uses the deprecated property it still works. OIDC ui processor is only invoked when dev service is disabled so it can't depend on the Keycloak dev service specific property.

michalvavrik commented 11 months ago

@michalvavrik The log output is now collapsed once the container has started, so that output is there initially but unfortunately hard to see

Understand, maybe it depends on how quick one's machine is, but if it is common not so see it (I tried again because of code flow default value check) I think text probably shouldn't raise my expectations. I'll leave you to decide.

As far as the code grant is concerned, keycloak dev service specific property has been deprecated so the code allows to use another property such that if someone uses the deprecated property it still works. OIDC ui processor is only invoked when dev service is disabled so it can't depend on the Keycloak dev service specific property.

I tried it again and when I click to login I can see response_type=code in Keycloak query and later I can see it in Quarkus log, so you are right:

2023-12-12 08:43:03,152 INFO  [io.qua.oid.run.dev.OidcDevServicesUtils] (vert.x-eventloop-thread-3) Using authorization_code grant to get a token from 'http://localhost:32771/realms/quarkus/protocol/openid-connect/token' with client id 'quarkus-app

But my initial point is still there: you mentioned here at one line of guide that code is default, but where else can I find it? Can you add some note to configuration property description or considering there is no default value, can you at document it, for example with defaultValueDocumentation:

        /**
         * Grant type which will be used to acquire a token to test the OIDC 'service' applications
         */
        @ConfigItem(defaultValueDocumentation = "code is default unless XYZ")
        public Optional<Type> type;