Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WFLY-12901] Add a new quickstart covering MicroProfile JWT. #368

Merged
merged 1 commit into from Mar 18, 2020

Conversation

darranl
Copy link
Contributor

@darranl darranl commented Jan 28, 2020

Includes a complete example and instructions to create the example from scratch.
Also contains a test case to enable testing the interaction with the example.

https://issues.redhat.com/browse/WFLY-12901

Analysis - wildfly/wildfly-proposals#273

Depends on wildfly/wildfly-archetypes#6

@sschmiedleitner
Copy link

After reviewing this PR I have some concerns...

I would have expected to get an idea, how to use Wildfly 19 with a deployed microprofile application, that just is secured by JWT. The JWT is not issued by this wildfly but rather by an external keycloak server (at least I have such a setup).

But your PR indicates, that there is a very special configuration of Elytron needed (issuer, keystore) which I don't have with an external authentication server like keycloak. It should rather use the settings of the microprofile.properties file:

mp.jwt.verify.issuer=
mp.jwt.verify.publickey[.location]=

How can I manage this?

@darranl
Copy link
Contributor Author

darranl commented Jan 30, 2020

The reason this as a quickstart is not using an external issuer is that it would be a lot of additional complexity just to get the quickstart running when the token issuing can be simplified.

Overall the aim of this quickstart is to demonstrate how to enable MicroProfile JWT authentication for a deployment deployed to WildFly it was not about setting up the complete environment, projects such as KeyCloak would then provide their own getting started material to start to use them as an issuer.

I am not really sure what you mean with this line: -

But your PR indicates, that there is a very special configuration of Elytron needed (issuer, keystore)

This pull request does not mention Elytron once, this quickstart exclusively makes use of microprofile config properties for configuration.

@sschmiedleitner
Copy link

sschmiedleitner commented Jan 30, 2020

Hm, Elytron is mentioned in the chapter "Configure the Server" serveral times and also refers to configure-elytron.cli.

I can follow the approach that a quickstart should not have too much external dependencies - I aggree.

Still I would like to get my setup running somehow and I am searching for input how to configure Wildfly 19 properly to use my configuration from microprofile.properties and @LoginConfig

@darranl darranl force-pushed the WFLY-12901 branch 2 times, most recently from 204c6e5 to 1f5cea7 Compare January 30, 2020 15:17
@darranl
Copy link
Contributor Author

darranl commented Jan 30, 2020

This may be a bit clearer now, the main files were missing from this pull request.

@sschmiedleitner
Copy link

I am really sorry, I was looking at the "jaxrs-jwt" quickstart, not your new one...

With the correct "microprofile-jwt" I was able to figure out that I need to set the "resteasy.role.based.security" configuration properly!

@rhusar
Copy link
Member

rhusar commented Mar 6, 2020

Depends on wildfly/wildfly-archetypes#6

Might wanna update that since it was closed by @maeste.

@darranl
Copy link
Contributor Author

darranl commented Mar 6, 2020

@rhusar Yes that is the plan to rewrite using a generic archetype.

@darranl darranl force-pushed the WFLY-12901 branch 2 times, most recently from b0f37ed to ac1f27c Compare March 17, 2020 12:39
@darranl
Copy link
Contributor Author

darranl commented Mar 17, 2020

@emmartins This quickstart is now also updated so all of it's dependencies beyond "wildfly-jakartaee8-with-tools" are now included in it's pom without modifications to the parent pom.

Comment on lines 310 to 314
@GET
@Path("/helloworld")
public String helloworld() {
return "Hello World";
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation is off here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


<artifactId>microprofile-jwt</artifactId>
<packaging>war</packaging>
<name>JBoss PRODUCT_TYPE Quickstart: MicroProfile JWT</name>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The standard module names are "Quickstart: artifactId", e.g. https://github.com/wildfly/quickstart/blob/master/contacts-jquerymobile/pom.xml#L33

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This format comes directly from the template https://github.com/wildfly/quickstart/blob/master/template/pom.xml#L25

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks like the template is outdated, i.e.

:-)

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Quickstart: Parent 20.0.0.Beta1-SNAPSHOT:
[INFO]
[INFO] Quickstart: Parent ................................. SUCCESS [  0.090 s]
[INFO] Quickstart: app-client ............................. SUCCESS [  0.002 s]
[INFO] Quickstart: app-client - ejb ....................... SUCCESS [  0.018 s]
[INFO] Quickstart: app-client - client-simple ............. SUCCESS [  0.010 s]
[INFO] Quickstart: app-client - ear ....................... SUCCESS [  0.029 s]
[INFO] Quickstart: batch-processing ....................... SUCCESS [  0.036 s]
[INFO] Quickstart: bean-validation ........................ SUCCESS [  0.017 s]
...
[INFO] JBoss PRODUCT_TYPE Quickstart: MicroProfile JWT .... SUCCESS [  0.002 s]
[INFO] Quickstart: numberguess ............................ SUCCESS [  0.010 s]
[INFO] Quickstart: payment-cdi-event ...................... SUCCESS [  0.015 s]
[INFO] Quickstart: resteasy-jaxrs-client .................. SUCCESS [  0.011 s]
[INFO] Quickstart: security-domain-to-domain .............. SUCCESS [  0.003 s]
[INFO] Quickstart: security-domain-to-domain - ejb ........ SUCCESS [  0.010 s]
[INFO] Quickstart: security-domain-to-domain - web ........ SUCCESS [  0.015 s]
[INFO] Quickstart: security-domain-to-domain - ear ........ SUCCESS [  0.005 s]
[INFO] Quickstart: servlet-async .......................... SUCCESS [  0.015 s]
[INFO] Quickstart: servlet-filterlistener ................. SUCCESS [  0.013 s]
[INFO] Quickstart: servlet-security ....................... SUCCESS [  0.013 s]
[INFO] Quickstart: shopping-cart .......................... SUCCESS [  0.001 s]
[INFO] Quickstart: shopping-cart - server ................. SUCCESS [  0.008 s]
[INFO] Quickstart: shopping-cart - client ................. SUCCESS [  0.008 s]
[INFO] Quickstart: spring-greeter ......................... SUCCESS [  0.019 s]
[INFO] Quickstart: spring-kitchensink-basic ............... SUCCESS [  0.025 s]
[INFO] Quickstart: spring-kitchensink-springmvctest ....... SUCCESS [  0.022 s]
[INFO] Quickstart: spring-resteasy ........................ SUCCESS [  0.012 s]
[INFO] Quickstart: tasks-jsf .............................. SUCCESS [  0.016 s]
[INFO] Quickstart: tasks-rs ............................... SUCCESS [  0.015 s]
[INFO] Quickstart: temperature-converter .................. SUCCESS [  0.012 s]
[INFO] Quickstart: thread-racing .......................... SUCCESS [  0.028 s]
[INFO] Quickstart: websocket-client ....................... SUCCESS [  0.013 s]
[INFO] Quickstart: websocket-endpoint ..................... SUCCESS [  0.014 s]
[INFO] Quickstart: websocket-hello ........................ SUCCESS [  0.009 s]
[INFO] Quickstart: wicket-ear ............................. SUCCESS [  0.001 s]
[INFO] Quickstart: wicket-ear - ejb ....................... SUCCESS [  0.009 s]
[INFO] Quickstart: wicket-ear - war ....................... SUCCESS [  0.019 s]
[INFO] Quickstart: wicket-ear - ear ....................... SUCCESS [  0.004 s]
[INFO] Quickstart: wicket-war ............................. SUCCESS [  0.019 s]
[INFO] Quickstart: xml-jaxp ............................... SUCCESS [  0.018 s]
[INFO] Quickstart: jts .................................... SUCCESS [  0.002 s]
[INFO] Quickstart: jts - application-component-2 .......... SUCCESS [  0.012 s]
[INFO] Quickstart: jts - application-component-1 .......... SUCCESS [  0.014 s]
[INFO] Quickstart: ejb-remote ............................. SUCCESS [  0.001 s]
[INFO] Quickstart: ejb-remote - server-side ............... SUCCESS [  0.007 s]
[INFO] Quickstart: ejb-remote - client .................... SUCCESS [  0.010 s]
[INFO] Quickstart: jta-crash-rec .......................... SUCCESS [  0.011 s]
[INFO] Quickstart: wsat-simple ............................ SUCCESS [  0.016 s]
[INFO] Quickstart: wsba-coordinator-completion-simple ..... SUCCESS [  0.012 s]
[INFO] Quickstart: wsba-participant-completion-simple ..... SUCCESS [  0.012 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.461 s
[INFO] Finished at: 2020-03-17T14:37:54+01:00
[INFO] ------------------------------------------------------------------------

Copy link
Member

@rhusar rhusar Mar 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #392 with the template fix.

Includes a complete example and instructions to create the example from scratch.
Also contains a test case to enable testing the interaction with the example.
@emmartins emmartins merged commit 820eebe into wildfly:master Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants