|-.idea
|-.mvn
|-src
|-java
|-resources
|-static
|-resources
|-script
|-styles
|-index.html
You can use static folder to publish index html if you didn't enable security.
If you enabled the security layer then you have to configure it.
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
@AllArgsConstructor
public class CustomWebSecurity extends WebSecurityConfigurerAdapter {
private final UserService userService;
private final ObjectMapper objectMapper;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().cors().and().authorizeRequests()
.antMatchers(HttpMethod.POST, ChallengeConstant.AUTHORIZE_ENDPOINT).permitAll()
.antMatchers(HttpMethod.POST, ChallengeConstant.TOKEN_ENDPOINT).permitAll()
.antMatchers(HttpMethod.GET, "/*").permitAll()
.antMatchers(HttpMethod.GET, "/assets/**").permitAll()
.anyRequest().authenticated()
.and()
.addFilterBefore(new JWTFilter(userService, objectMapper), UsernamePasswordAuthenticationFilter.class)
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
}
}
Here is an example of configuration.
Below two lines will skip auth flows for index html and asset folder.
.antMatchers(HttpMethod.GET, "/*").permitAll()
.antMatchers(HttpMethod.GET, "/assets/**").permitAll()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…