Null check on tokenTypeHint variable#3
Open
dileepagayan wants to merge 3 commits intofacilelogin:masterfrom
Open
Null check on tokenTypeHint variable#3dileepagayan wants to merge 3 commits intofacilelogin:masterfrom
dileepagayan wants to merge 3 commits intofacilelogin:masterfrom
Conversation
rushmin
suggested changes
Nov 7, 2017
| accessToken.setIdentifier(token); | ||
| accessToken.setTokenType(tokenTypeHint); | ||
|
|
||
| if(tokenTypeHint != null && !tokenTypeHint.isEmpty()) { |
| if(tokenTypeHint != null && !tokenTypeHint.isEmpty()) { | ||
| accessToken.setTokenType(tokenTypeHint); | ||
| }else { | ||
| accessToken.setTokenType("bearer"); |
There was a problem hiding this comment.
Use the already defined 'DEFAULT_TOKEN_TYPE_HINT' constant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When we build the token introspection component using JDK 1.8, it throws a below error,
[2017-10-25 17:31:58,950] ERROR {org.apache.catalina.core.StandardWrapperValve} - Servlet.service() for servlet [cxf] in context with path [/introspect] threw exception java.lang.RuntimeException: org.apache.cxf.interceptor.Fault at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:336)Furthermore, I debugged the code and identified that the request hits the method with two parameters (i.e. introspect(@FormParam("token") String token, @FormParam("token_type_hint") String tokenTypeHint)) even if we send just one parameter (i.e Token) in JDK 1.8.
In order to fix the error, I removed the single parameter method (i.e introspect(@FormParam("token") String token) ) and added a null check on tokenTypeHint parameter string.
I tested the component with both JDK 1.8 and JDK 1.7 it works fine with both versions now.