Skip to content
Snippets Groups Projects
Commit 00c33893 authored by Jozef Gajdoš's avatar Jozef Gajdoš
Browse files

Resolve comments

parent 9b0806c7
No related branches found
No related tags found
No related merge requests found
......@@ -21,8 +21,7 @@ public class SecurityConfig {
.requestMatchers("/v3/api-docs/**").permitAll()
.requestMatchers("/certificates/**").hasAnyAuthority(LECTURER_SCOPE, ADMIN_SCOPE)
)
.oauth2ResourceServer(oauth2 -> oauth2.opaqueToken(Customizer.withDefaults()))
;
.oauth2ResourceServer(oauth2 -> oauth2.opaqueToken(Customizer.withDefaults()));
return http.build();
}
}
......@@ -27,8 +27,7 @@ public class SecurityConfig {
.requestMatchers(HttpMethod.POST, "/lectures/**", "/courses/**", "/exercises/**", "/lectures/**").hasAnyAuthority(LECTURER_SCOPE, ADMIN_SCOPE)
.requestMatchers(HttpMethod.DELETE, "/lectures/**", "/courses/**", "/exercises/**", "/lectures/**").hasAnyAuthority(LECTURER_SCOPE, ADMIN_SCOPE)
)
.oauth2ResourceServer(oauth2 -> oauth2.opaqueToken(Customizer.withDefaults()))
;
.oauth2ResourceServer(oauth2 -> oauth2.opaqueToken(Customizer.withDefaults()));
return http.build();
}
}
......@@ -22,8 +22,7 @@ public class SecurityConfig {
.requestMatchers("/v3/api-docs/**").permitAll()
.requestMatchers("/emails/**").hasAnyAuthority(LECTURER_SCOPE, STUDENT_SCOPE, ADMIN_SCOPE)
)
.oauth2ResourceServer(oauth2 -> oauth2.opaqueToken(Customizer.withDefaults()))
;
.oauth2ResourceServer(oauth2 -> oauth2.opaqueToken(Customizer.withDefaults()));
return http.build();
}
}
......@@ -16,11 +16,7 @@ import org.springframework.web.bind.annotation.GetMapping;
public class MainController {
@GetMapping("/")
public String index(@AuthenticationPrincipal OidcUser user) {
if (user != null) {
return "redirect:/authscreen";
} else {
return "index";
}
return user == null ? "index" : "redirect:/authscreen";
}
@GetMapping("/authscreen")
......
......@@ -24,6 +24,10 @@ public class OidcClientApplication {
/**
* Configuration of Spring Security. Sets up OAuth2/OIDC authentication
* for all URLS except a list of public ones.
*
* @param httpSecurity the builder that is used to build the SecurityFilterChain
* @return the security Filter Chain
* @throws Exception possible failure of authorizeHttpRequests
*/
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception {
......@@ -42,8 +46,7 @@ public class OidcClientApplication {
.csrf(c -> c
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.csrfTokenRequestHandler(new CsrfTokenRequestAttributeHandler())
)
;
);
return httpSecurity.build();
}
......
......@@ -30,8 +30,7 @@ public class SecurityConfig {
.requestMatchers("/swagger-ui/**").permitAll()
.requestMatchers("/v3/api-docs/**").permitAll()
)
.oauth2ResourceServer(oauth2 -> oauth2.opaqueToken(Customizer.withDefaults()))
;
.oauth2ResourceServer(oauth2 -> oauth2.opaqueToken(Customizer.withDefaults()));
return http.build();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment