-
Notifications
You must be signed in to change notification settings - Fork 4
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
How can I use the signature configuration from the JWT subsystem in wildfly to generate tokens in application code deployed in the same server #9
Comments
Confirming that I understand your question: |
@ceharris correct |
The JWT extension is generally used in an application setting where you want the Java EE container (Wildfly) to do JWT validation. Consequently, it doesn't provide much help here for generating tokens, since this is usually done in a separate OAuth2 authorization server. It is possible to get the Wildfly subsystem configuration into a deployed application. One could put the right Wildfly management modules onto the application class loader (e.g. using jboss-deployment-descriptor.xml) and then use Wildfly API to get a reference to the subsystem instance in the management module and access its state. It's probably not all that convenient, but it is doable. Alternatively, the application could use the same |
Got you. And thanks for explanation. |
Another approach, rather than using symmetric keys would be to use an RSA key pair. The Wildfly subsystem then only needs the public key part to validate, and your application could have access to the private key. Then the only shared part of the configuration is the name of the algorithm, issuer name, etc. |
Assume we build a jwt token and want to use signature encription defined in standalone.xml
<subsystem xmlns="urn:soulwing.org:jwt:1.0">
...
<secret-key name="yourbunnywrote" id="1863" type="AES" length="256" provider="FILE">
<properties>
<property name="path" value="${jboss.server.config.dir}/signature-secret-key"/>
</properties>
</secret-key>
...
<signature name="figvam" algorithm="HS256" secret-keys="yourbunnywrote"/>
<validator name="default" issuer="iss" issuer-url="https://iss" audience="test-service" expiration-tolerance="90" signature="figvam"/>
</subsystem>
How can I get a signature config from server configuration and use it when I build a signature like below
I mean is there a convenient way to get SECRET_KEY_FROM_CONFIG and ALG_FROM_CONFIG in code?
The text was updated successfully, but these errors were encountered: