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

Fix ZacTokenService Issue #42

Merged
merged 3 commits into from
Jan 30, 2018

Conversation

RoopGuron
Copy link
Contributor

No description provided.

@RoopGuron RoopGuron closed this Jan 27, 2018
@RoopGuron RoopGuron reopened this Jan 27, 2018
@RoopGuron RoopGuron closed this Jan 27, 2018
@RoopGuron RoopGuron reopened this Jan 27, 2018
tokenServices.setUseHttps(this.useHttps);
tokenServices.setTrustedIssuers(trustedIssuers);
try {
tokenServices = this.beanFactory.getBean(FastTokenServices.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

why get this bean from the context, if this class is going to override all properties anyway? I suggest use new always.
Also, tokenService is private to this class, and never expected to be configured externally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. Since fastTokenservices is referenced/created in a local method scope in the ZacTokenService, would need to bring in powermock to write unit tests. I suspect the Creator might have been used to overcome testing challenges.

public class FastTokenServicesCreator {

public FastTokenServices newInstance() {
return new FastTokenServices();
FastTokenServices fastTokenServices = new FastTokenServices();
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of having to catch Exception here, consider changing FastTokenService to use a regular map in the initializer for tokenKeys (line 87). It can then override to a expiring map, if afterPropertiesSet is called. This file will not require any change other than marking as deprecated.

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 like that less change and more control. Practicality trumps idealism.

Signed-off-by: Henry <henry.zhao1@ge.com>
@ge-guardians ge-guardians force-pushed the DE60291-FastTokenServices-TimedRefresh branch from 958e361 to 6fb2d55 Compare January 29, 2018 18:50
RoopGuron and others added 2 commits January 29, 2018 15:51
Signed-off-by: Henry <henry.zhao1@ge.com>
@sanjeevchopra sanjeevchopra merged commit f0fba59 into develop Jan 30, 2018
@sanjeevchopra sanjeevchopra deleted the DE60291-FastTokenServices-TimedRefresh branch January 30, 2018 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants