File tree 1 file changed +7
-2
lines changed
samples/demo-authorizationserver/src/main/java/sample/config 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 30
30
import org .springframework .context .annotation .Configuration ;
31
31
import org .springframework .core .Ordered ;
32
32
import org .springframework .core .annotation .Order ;
33
+ import org .springframework .http .MediaType ;
33
34
import org .springframework .jdbc .core .JdbcTemplate ;
34
35
import org .springframework .jdbc .datasource .embedded .EmbeddedDatabase ;
35
36
import org .springframework .jdbc .datasource .embedded .EmbeddedDatabaseBuilder ;
55
56
import org .springframework .security .oauth2 .server .authorization .token .OAuth2TokenCustomizer ;
56
57
import org .springframework .security .web .SecurityFilterChain ;
57
58
import org .springframework .security .web .authentication .LoginUrlAuthenticationEntryPoint ;
59
+ import org .springframework .security .web .util .matcher .MediaTypeRequestMatcher ;
58
60
59
61
/**
60
62
* @author Joe Grandja
@@ -116,8 +118,11 @@ public SecurityFilterChain authorizationServerSecurityFilterChain(
116
118
117
119
// @formatter:off
118
120
http
119
- .exceptionHandling (exceptions ->
120
- exceptions .authenticationEntryPoint (new LoginUrlAuthenticationEntryPoint ("/login" ))
121
+ .exceptionHandling ((exceptions ) -> exceptions
122
+ .defaultAuthenticationEntryPointFor (
123
+ new LoginUrlAuthenticationEntryPoint ("/login" ),
124
+ new MediaTypeRequestMatcher (MediaType .TEXT_HTML )
125
+ )
121
126
)
122
127
.oauth2ResourceServer (oauth2ResourceServer ->
123
128
oauth2ResourceServer .jwt (Customizer .withDefaults ()));
You can’t perform that action at this time.
0 commit comments