-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Task #3011]The JwtRuleHandle should be coustomerd #4133
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4133 +/- ##
============================================
- Coverage 70.33% 70.25% -0.08%
- Complexity 7172 7174 +2
============================================
Files 965 968 +3
Lines 26934 26962 +28
Branches 2399 2403 +4
============================================
- Hits 18944 18943 -1
- Misses 6538 6563 +25
- Partials 1452 1456 +4
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
why do you do like this? |
...lugin-jwt/src/test/resources/META-INF/shenyu/org.apache.shenyu.plugin.jwt.rule.JwtRuleHandle
Outdated
Show resolved
Hide resolved
* @param handleJson handleJson from rule | ||
* @return jwtRuleHandle | ||
*/ | ||
T parseHandleJson(String handleJson); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can skip generics here,
JwtRuleHandle parseHandleJson(String handleJson);
This also returns a subclass without warning
no SuppressWarnings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the advice,but I think it has a problem . If you replace generics by JwtRuleHandle, it can happen class type of the result of executing parseHandleJson
is diffrent from first parameter of ServerWebExchange convert
. I think it is unreasonable for this to happen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseHandleJson must return : JwtRuleHandle or ? extent JwtRuleHandle
Generics are weakly constrained and type-ambiguous.
It's better to have a strong constraint here
eg:
@SuppressWarnings
public class MyJwtConvertStrategy implements JwtConvertStrategy {
Object parseHandleJson(String handleJson){
// ... ...
}
}
Looks like a lot of good |
Thanks <3 |
...henyu-plugin-jwt/src/main/java/org/apache/shenyu/plugin/jwt/handle/JwtPluginDataHandler.java
Outdated
Show resolved
Hide resolved
...lugin-jwt/src/main/java/org/apache/shenyu/plugin/jwt/strategy/DefaultJwtConvertStrategy.java
Show resolved
Hide resolved
you maybe know spi |
* @param handleJson handleJson from rule | ||
* @return jwtRuleHandle | ||
*/ | ||
T parseHandleJson(String handleJson); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseHandleJson must return : JwtRuleHandle or ? extent JwtRuleHandle
Generics are weakly constrained and type-ambiguous.
It's better to have a strong constraint here
eg:
@SuppressWarnings
public class MyJwtConvertStrategy implements JwtConvertStrategy {
Object parseHandleJson(String handleJson){
// ... ...
}
}
Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true
.finished task #3011
client could be customed JwtRuleHandle
for example
handle format is