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

[ELY-2083] Token based authentication between clients and servers. Token issuance functionality. #1541

Closed

Conversation

SoniaZaldana
Copy link
Contributor

@SoniaZaldana SoniaZaldana marked this pull request as draft June 14, 2021 20:16
* @return a JWT access token in String representation
* @throws Exception
*/
String issueAccessToken(SecurityIdentity securityIdentity) throws JwtException;
Copy link
Contributor

Choose a reason for hiding this comment

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

Something we had discussed before was making sure that we could either generate our own tokens or make use of an external provider. One thing I'm wondering about is whether it makes sense for this interface method to take a SecurityIdentity as a parameter. The SecurityIdentity is definitely something that's need when generating our own tokens. But, it likely wouldn't be needed if using an external provider to obtain the token. In that case, an OAuth2CredentialSource would likely be used.


private KeyStore keyStore;
private String issuer = "WildFly Elytron";
private long accessTokenExpiryTime = 300;
Copy link
Contributor

Choose a reason for hiding this comment

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

For constants like this, it's good to declare it as follows:

private static final long ACCESS_TOKEN_EXPIRY_TIME = 300;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was using this variable as a default initial value, although it can be altered with the builder if they choose to use a different expiry time. Should I create some constants and have them be separate instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, got it. Yes, you can create a separate constant and initialize accessTokenExpirytTime using the constant.

@wildfly-ci
Copy link

Windows Build 723 outcome was FAILURE using a merge of fa04ef9
Summary: Tests failed: 1 (1 new), passed: 1256, ignored: 22 Build time: 00:12:42

Failed tests

org.wildfly.security.auth.WildFlyElytronTokenProviderTest.testIssuingTokenWithSigningAndEncryption: org.wildfly.security.auth.server.jwt.LoadingKeyException: ELY16011: Failed to load public or private key from keystore
	at org.wildfly.security.auth.server.jwt.WildFlyElytronTokenProvider.<init>(WildFlyElytronTokenProvider.java:153)
	at org.wildfly.security.auth.server.jwt.WildFlyElytronTokenProvider$Builder.build(WildFlyElytronTokenProvider.java:605)
	at org.wildfly.security.auth.WildFlyElytronTokenProviderTest.testIssuingTokenWithSigningAndEncryption(WildFlyElytronTokenProviderTest.java:164)
Caused by: java.lang.NullPointerException
	at org.wildfly.security.auth.server.jwt.WildFlyElytronTokenProvider.loadPublicKey(WildFlyElytronTokenProvider.java:269)
	at org.wildfly.security.auth.server.jwt.WildFlyElytronTokenProvider.<init>(WildFlyElytronTokenProvider.java:147)
	... 2 more


@fjuma
Copy link
Contributor

fjuma commented May 7, 2024

Going to close this one for now until we are ready to pick up working on it again.

@fjuma fjuma closed this May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants