Revize 2fb633dc
Přidáno uživatelem Jakub Šmíd před asi 3 roky(ů)
backend/src/main/java/cz/zcu/kiv/backendapi/security/SecurityConfig.java | ||
---|---|---|
43 | 43 |
/** |
44 | 44 |
* List of permitted pages without login |
45 | 45 |
*/ |
46 |
private final String[] permittedUrls = new String[]{"/login", "/token/refresh", "/register", "/swagger-ui/**",
|
|
46 |
private final String[] permittedUrls = new String[]{"/login", "/users/token", "/register", "/swagger-ui/**",
|
|
47 | 47 |
"/swagger-ui.html", "/v3/api-docs", "/v3/api-docs/swagger-config"}; |
48 | 48 |
|
49 | 49 |
/** |
... | ... | |
58 | 58 |
csrf().disable() |
59 | 59 |
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) |
60 | 60 |
.and() |
61 |
.addFilter(new JwtUsernameAndPasswordAuthenticationFilter(authenticationManager(), jwtUtils)) |
|
62 |
.addFilterAfter(new JwtTokenVerifier(jwtUtils, permittedUrls), JwtUsernameAndPasswordAuthenticationFilter.class) |
|
61 | 63 |
.authorizeRequests() |
62 | 64 |
.antMatchers(permittedUrls).permitAll() |
63 | 65 |
.antMatchers("/user/update-permissions/**", "/user/reset-password/**").hasRole(Role.ADMIN.name()) |
... | ... | |
66 | 68 |
.antMatchers("/read/**").hasAuthority(Permission.READ.name()) |
67 | 69 |
.antMatchers("/delete/**").hasAuthority(Permission.DELETE.name()) |
68 | 70 |
.anyRequest() |
69 |
.authenticated() |
|
70 |
.and() |
|
71 |
.logout() |
|
72 |
.and() |
|
73 |
.addFilter(new JwtUsernameAndPasswordAuthenticationFilter(authenticationManager(), jwtUtils)) |
|
74 |
.addFilterAfter(new JwtTokenVerifier(jwtUtils, permittedUrls), JwtUsernameAndPasswordAuthenticationFilter.class); |
|
71 |
.authenticated(); |
|
75 | 72 |
|
76 | 73 |
} |
77 | 74 |
|
Také k dispozici: Unified diff
Changed security