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

#241: JWT: added spring-boot starters and auto-config, added JUnit tests #247

Merged
merged 6 commits into from
Apr 24, 2020

Conversation

hohwille
Copy link
Member

Fix for #241:

  • added auto-configs
  • added spring-boot starters
  • added JUnit tests

@hohwille hohwille added enhancement New feature or request security test labels Apr 24, 2020
@hohwille hohwille added this to the release:2020.04.001 milestone Apr 24, 2020
@hohwille
Copy link
Member Author

[ERROR] /home/travis/build/devonfw/devon4j/starters/starter-security-jwt/src/test/java/com/devonfw/module/security/jwt/common/api/JwtCreatorTest.java:[31,11] error: cannot find symbol
symbol: method of(String,String)
location: interface Set

Method I used is not available in JDK 1.8.
Will fix asap.

@@ -21,6 +24,8 @@
*
* @since 2020.04.001
*/
@Component
@Order(SecurityProperties.BASIC_AUTH_ORDER - 1)
Copy link
Member

Choose a reason for hiding this comment

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

Nice ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Trade-off: to make spring-boot starter pluggable with convention over configuration I had to find a solution. Projects are free to depend on devon4j-security-jwt instead of the starter and manually configure the beans (e.g. creating the filter with new in WebSecurityConfigurer and add to filter chain in the desired place).

Copy link
Member

@vapadwal vapadwal Apr 24, 2020

Choose a reason for hiding this comment

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

Can we define @component here as in JwtAutoConfiguration we have defined it as Bean
@bean
public JwtAuthenticationFilter jwtAuthenticationFilter() {

return new JwtAuthenticationFilter();

}

Same for
@bean
public JwtConfigProperties jwtConfigProperties() {

return new JwtConfigProperties();

}

Getting error while running mtsj
The bean 'jwtConfigProperties', defined in class path resource [com/devonfw/module/security/jwt/common/impl/JwtAutoConfiguration.class], could not be registered. A bean with that name has already been defined in URL [jar:file:/D:/projects/devon/devon-ide-scripts-3.0.0-beta24/conf/.m2/repository/com/devonfw/java/modules/devon4j-security-jwt/2020.04.001-SNAPSHOT/devon4j-security-jwt-2020.04.001-SNAPSHOT.jar!/com/devonfw/module/security/jwt/common/impl/JwtConfigProperties.class] and overriding is disabled.

same error for JwtAuthenticationFilter
The bean 'jwtAuthenticationFilter', defined in class path resource [com/devonfw/module/security/jwt/common/impl/JwtAutoConfiguration.class], could not be registered. A bean with that name has already been defined in URL [jar:file:/D:/projects/devon/devon-ide-scripts-3.0.0-beta24/conf/.m2/repository/com/devonfw/java/modules/devon4j-security-jwt/2020.04.001-SNAPSHOT/devon4j-security-jwt-2020.04.001-SNAPSHOT.jar!/com/devonfw/module/security/jwt/common/base/JwtAuthenticationFilter.class] and overriding is disabled.

Copy link
Member

@maihacke maihacke left a comment

Choose a reason for hiding this comment

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

@hohwille
Copy link
Member Author

Please change


. It should be delay not "deplay".

Please also fix this in https://github.com/vapadwal/devon4j/blob/update_jwt/documentation/guide-jwt.asciidoc#configuration

OMG stupid typo. That's what reviews are good for :) Thanks so much @maihacke

@hohwille hohwille merged commit 0120bea into devonfw:develop Apr 24, 2020
@vapadwal vapadwal mentioned this pull request May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request security test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants