Compare commits

...

3 Commits

Author SHA1 Message Date
Lea
bbbf0a9473 homepage skeleton 2025-02-12 08:54:28 +01:00
Huy
2cd1c6d8fd feat: Create initial landing page (CAS-8) (!11)
Co-authored-by: Phan Huy Tran <p.tran@neusta.de>
Reviewed-on: #11
Reviewed-by: Constantin Simonis <constantin@simonis.lol>
Reviewed-by: lziemke <lea.z4@schule.bremen.de>
2025-02-12 07:43:05 +00:00
Huy
35bfa3be7f fix: Fix security config, add health check route and adjust requests (!9)
Co-authored-by: Phan Huy Tran <p.tran@neusta.de>
Reviewed-on: #9
Reviewed-by: Constantin Simonis <constantin@simonis.lol>
Reviewed-by: lziemke <lea.z4@schule.bremen.de>
2025-02-05 11:38:00 +00:00
12 changed files with 123 additions and 40 deletions

View File

@ -1,21 +0,0 @@
@token = eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICIxX3I2eDlta1B3cm9NWHQ5Q1Y4cktyak5WNndybktrWnI0Qk5xYW9QM2VVIn0.eyJleHAiOjE3MjYwNDA4NDQsImlhdCI6MTcyNjA0MDU0NCwianRpIjoiZmIwNWJhNzAtMmFkYy00ZDQyLWJjOWUtMWVmZTE5NjJiMTc2IiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo5MDkwL3JlYWxtcy9MRjEyIiwiYXVkIjoiYWNjb3VudCIsInN1YiI6IjUyY2MwMjA4LWEzYmQtNDM2Ny05NGM1LTA0MDRiMDE2YTAwMyIsInR5cCI6IkJlYXJlciIsImF6cCI6ImxmMTIiLCJzZXNzaW9uX3N0YXRlIjoiMTdlOGRkMjEtMDQ3OS00ZTM1LTgxOTUtOGY5NmFiNWExNjAwIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyJodHRwOi8vbG9jYWxob3N0OjQyMDAiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbImRlZmF1bHQtcm9sZXMtbGYxMiIsImxmMTJfdGVzdF9yb2xlIiwib2ZmbGluZV9hY2Nlc3MiLCJ1bWFfYXV0aG9yaXphdGlvbiJdfSwicmVzb3VyY2VfYWNjZXNzIjp7ImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsInNpZCI6IjE3ZThkZDIxLTA0NzktNGUzNS04MTk1LThmOTZhYjVhMTYwMCIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwicHJlZmVycmVkX3VzZXJuYW1lIjoibGYxMl90ZXN0X3VzZXIifQ.gGPUe-0GGFb7yiko-o5yNlPoyTy3kJCEduwd-VHOLzJubAa9CeO_kjgtxYFDQP1xsBR32Wl6eCoSrz6JfAguU3bfuJ4vukKZ-MUWBc5K_It8NgqcdtR9cTs0nTF2qt2sTG99zn_2Cw9Xs0zc-YEkNHX_YnOZ-p0uMFk_YaEtwcjnw8rs00cbNMPLeAZe5C1QD8TNxZZerRgd0GVfs8P4z7exrJjxdVQeTK1jMz8B3uPCUqBRk1rQI3HLlWNfX195Vcituppj7so9mupq7sit8o9g_gxrVKYObZBVMlBDx-YujGA5QDBngiZZNHNyxseZjcbMyMZXsVTenuZbLU6aEA
###
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

@ -3,4 +3,4 @@ Content-Type: application/x-www-form-urlencoded
grant_type=password&client_id=lf12&username=lf12_test_user&password=secret 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 @@
GET localhost:8080/health

View File

@ -0,0 +1,15 @@
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,23 +52,12 @@ class KeycloakSecurityConfig {
@Bean @Bean
public SecurityFilterChain resourceServerFilterChain(HttpSecurity http) throws Exception { public SecurityFilterChain resourceServerFilterChain(HttpSecurity http) throws Exception {
http.authorizeHttpRequests(auth -> auth http.authorizeHttpRequests(auth -> auth
.requestMatchers(new AntPathRequestMatcher("/welcome")) .requestMatchers("/swagger", "/swagger-ui/**", "/v3/api-docs/**", "/health").permitAll()
.permitAll() .anyRequest().authenticated()
.requestMatchers( )
new AntPathRequestMatcher("/swagger"), .oauth2ResourceServer(spec -> spec.jwt(Customizer.withDefaults()));
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(); return http.build();
} }

View File

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

View File

@ -0,0 +1,35 @@
<nav class="bg-black border-b border-amber-600/30 sticky top-0 z-50">
<div class="container mx-auto px-4 py-3 flex justify-between items-center">
<!-- logo goes here -->
<div class="flex gap-4">
<button (click)="onLogout()" class="px-6 py-2 text-black bg-amber-500 hover:bg-amber-400 rounded-full font-bold transition-all duration-300 hover:shadow-lg hover:shadow-amber-500/20">
Ausloggen
</button>
</div>
<div>
<button (click)="openUserInfo()" class="px-6 py-2 text-black bg-amber-500 hover:bg-amber-400 rounded-full font-bold transition-all duration-300 hover:shadow-lg hover:shadow-amber-500/20">
Benutzer
</button>
</div>
</div>
<!-- Todo Dropdown für Benutzermenu (Dailytracker) -->
</nav>
<!-- Spiele mit Vorschau, Name und "Jetzt spielen" Button -->
<div class="gird grid-col-3">
<div class="w-full h-full">
<p>Spiel Vorschau</p>
<p>Spiel Name</p>
<button type="button" >Jetzt spielen</button>
</div>
<div class="w-full h-full">
<p>Spiel Vorschau</p>
<p>Spiel Name</p>
<button type="button" >Jetzt spielen</button>
</div>
<div class="w-full h-full">
<p>Spiel Vorschau</p>
<p>Spiel Name</p>
<button type="button" >Jetzt spielen</button>
</div>
</div>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomepageComponent } from './homepage.component';
describe('HomepageComponent', () => {
let component: HomepageComponent;
let fixture: ComponentFixture<HomepageComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HomepageComponent]
})
.compileComponents();
fixture = TestBed.createComponent(HomepageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,20 @@
import {ChangeDetectionStrategy, Component} from '@angular/core';
@Component({
selector: 'app-homepage',
standalone: true,
imports: [],
templateUrl: './homepage.component.html',
styleUrl: './homepage.component.css',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class HomepageComponent {
onLogout() {
//TODO implement
}
openUserInfo() {
//TODO implement
}
}

View File

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