feat(stream): connect nginx with backend with controllers

This commit is contained in:
2026-05-18 22:27:49 +01:00
parent 3b188a3497
commit 1dbc40d8e6
12 changed files with 170 additions and 12 deletions

View File

@@ -16,8 +16,10 @@ import org.springframework.stereotype.Service;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.HexFormat;
import java.util.Optional;
@Service
@@ -77,6 +79,7 @@ public class UserService {
if (existingUser.isEmpty()) {
user.setRole(0);
user.setCreatedAt(LocalDateTime.now());
user.setStreamKey(generateStreamKey());
return userRepository.saveAndFlush(user);
}
@@ -111,4 +114,10 @@ public class UserService {
throw new NotAuthenticated("Invalid ID token: " + e.getMessage());
}
}
private String generateStreamKey() {
byte[] bytes = new byte[24];
new SecureRandom().nextBytes(bytes);
return HexFormat.of().formatHex(bytes);
}
}