File tree Expand file tree Collapse file tree 3 files changed +16
-29
lines changed
java/example/service/hello Expand file tree Collapse file tree 3 files changed +16
-29
lines changed Original file line number Diff line number Diff line change 99import org .springframework .security .core .userdetails .ReactiveUserDetailsService ;
1010import org .springframework .security .core .userdetails .User ;
1111import org .springframework .security .core .userdetails .UserDetails ;
12+ import org .springframework .security .oauth2 .jose .jws .MacAlgorithm ;
13+ import org .springframework .security .oauth2 .jwt .NimbusReactiveJwtDecoder ;
14+ import org .springframework .security .oauth2 .jwt .ReactiveJwtDecoder ;
1215import org .springframework .security .rsocket .core .PayloadSocketAcceptorInterceptor ;
1316
17+ import javax .crypto .Mac ;
18+ import javax .crypto .spec .SecretKeySpec ;
19+
1420@ Configuration
1521@ EnableRSocketSecurity
1622public class RSocketSecurityConfiguration {
@@ -49,4 +55,14 @@ public PayloadSocketAcceptorInterceptor rsocketInterceptor(RSocketSecurity rsock
4955
5056 return rsocket .build ();
5157 }
58+
59+ @ Bean
60+ public ReactiveJwtDecoder reactiveJwtDecoder () throws Exception {
61+ Mac mac = Mac .getInstance (MacAlgorithm .HS256 .getName ());
62+ SecretKeySpec secretKey = new SecretKeySpec ("demosecret" .getBytes (), mac .getAlgorithm ());
63+
64+ return NimbusReactiveJwtDecoder .withSecretKey (secretKey )
65+ .macAlgorithm (MacAlgorithm .HS256 )
66+ .build ();
67+ }
5268}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11# Properties
22spring.rsocket.server.port =7000
3-
4- # Security
5- example.service.hello.jwt.secret =demosecret
You can’t perform that action at this time.
0 commit comments