Compare commits

..

1 Commits

Author SHA1 Message Date
Lea
541d2dd1f7 homepage skeleton 2025-02-12 08:50:46 +01:00
8 changed files with 40 additions and 39 deletions

View File

@ -3,4 +3,4 @@ Content-Type: application/x-www-form-urlencoded
grant_type=password&client_id=lf12&username=lf12_test_user&password=secret
> {% client.global.set("token", response.body.access_token); %}

View File

@ -0,0 +1,21 @@
@token =eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICIxX3I2eDlta1B3cm9NWHQ5Q1Y4cktyak5WNndybktrWnI0Qk5xYW9QM2VVIn0.eyJleHAiOjE3Mzg3NTI4MjYsImlhdCI6MTczODc1MjUyNiwianRpIjoiNmQ0NjhkOWYtZDMwNC00NGIxLWI1YTctMjk3MTM1ODNmNDUzIiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo5MDkwL3JlYWxtcy9MRjEyIiwiYXVkIjoiYWNjb3VudCIsInN1YiI6IjUyY2MwMjA4LWEzYmQtNDM2Ny05NGM1LTA0MDRiMDE2YTAwMyIsInR5cCI6IkJlYXJlciIsImF6cCI6ImxmMTIiLCJzZXNzaW9uX3N0YXRlIjoiMzU3OTA4M2EtODNjZi00YTJjLTgwZGMtZmQzNDhkZTFjYWMxIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyJodHRwOi8vbG9jYWxob3N0OjQyMDAiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbImRlZmF1bHQtcm9sZXMtbGYxMiIsImxmMTJfdGVzdF9yb2xlIiwib2ZmbGluZV9hY2Nlc3MiLCJ1bWFfYXV0aG9yaXphdGlvbiJdfSwicmVzb3VyY2VfYWNjZXNzIjp7ImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsInNpZCI6IjM1NzkwODNhLTgzY2YtNGEyYy04MGRjLWZkMzQ4ZGUxY2FjMSIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwicHJlZmVycmVkX3VzZXJuYW1lIjoibGYxMl90ZXN0X3VzZXIifQ.th_MJfbMYC-99eMOy0tfYskFLqwiPAx2UH8_XpwgnUzYF6XvydTmpWXifYYQzQpET_QcdOVFeyYnuED29Zsl8td6zd5was-6OqPgASBV-ZODRJ0AshRCD_NiD4C63XpwxZ7vy75sbUfaAr1VV_E072tAVxihQQxfjYcGwgfOjL1g85GDzVX8qu0uO31-YMdTNhyeBxLnWV1s-SwuoWFxWGb-ObVsCj2t2WVOf9Nxh-MofXw4heJEkDsnZ45O-_8ewtOLycfbJuK6CW2mZUhRmtm4MCSWC6QhFMi3nVekTuzg0jnRHb64ANaRAlT5Qy6VwlVZxyhKDpZdvPGOxZ-Cww
###
GET localhost:8080/welcome
###
GET localhost:8080/roles
Authorization: Bearer {{token}}
###
GET localhost:8080/hellos
Authorization: Bearer {{token}}
###
POST localhost:8080/hellos
Authorization: Bearer {{token}}
Content-Type: application/json
{
"message": "test"
}

View File

@ -1 +0,0 @@
GET localhost:8080/health

View File

@ -1,15 +0,0 @@
package de.szut.casino.health;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
public class HealthController {
@GetMapping("/health")
public Map<String, String> healthCheck() {
return Map.of("status", "UP");
}
}

View File

@ -52,12 +52,23 @@ class KeycloakSecurityConfig {
@Bean
public SecurityFilterChain resourceServerFilterChain(HttpSecurity http) throws Exception {
http.authorizeHttpRequests(auth -> auth
.requestMatchers("/swagger", "/swagger-ui/**", "/v3/api-docs/**", "/health").permitAll()
.anyRequest().authenticated()
)
.oauth2ResourceServer(spec -> spec.jwt(Customizer.withDefaults()));
http.authorizeHttpRequests(auth -> auth
.requestMatchers(new AntPathRequestMatcher("/welcome"))
.permitAll()
.requestMatchers(
new AntPathRequestMatcher("/swagger"),
new AntPathRequestMatcher("/swagger-ui/**"),
new AntPathRequestMatcher("/v3/api-docs/**"))
.permitAll()
.requestMatchers(new AntPathRequestMatcher("/hello/**"))
.hasRole("lf12_test_role")
.requestMatchers(new AntPathRequestMatcher("/roles"))
.authenticated()
.requestMatchers(new AntPathRequestMatcher("/"))
.permitAll()
.anyRequest()
.authenticated()).oauth2ResourceServer(spec -> spec.jwt(Customizer.withDefaults()));
return http.build();
}

View File

@ -1,5 +1,4 @@
import {Routes} from '@angular/router';
import {LandingPageComponent} from "./landing-page/landing-page.component";
import {HomepageComponent} from "./homepage/homepage/homepage.component";
export const routes: Routes = [
@ -7,7 +6,4 @@ export const routes: Routes = [
path: 'home',
component: HomepageComponent
},
{ path: '', component: LandingPageComponent }
];

View File

@ -1,11 +0,0 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-landing-page',
standalone: true,
imports: [],
templateUrl: './landing-page.component.html',
})
export class LandingPageComponent {
}