refactor: rename keycloakId to authentikId in codebase
Some checks failed
CI / Get Changed Files (pull_request) Successful in 6s
CI / prettier (pull_request) Failing after 46s
CI / Checkstyle Main (pull_request) Successful in 49s
CI / eslint (pull_request) Failing after 1m2s
CI / test-build (pull_request) Failing after 1m9s

This commit is contained in:
Jan K9f 2025-04-02 15:49:58 +02:00
commit 8317349507
Signed by: jank
GPG key ID: B9F475106B20F144
12 changed files with 270 additions and 48 deletions

View file

@ -21,8 +21,18 @@ export class UserService {
}
public getOrCreateUser(profile: any): Observable<User> {
const id = profile.info.sub;
const username = profile.info.preferred_username;
console.log('Full authentik profile:', profile);
// Authentik format might differ from Keycloak
// Check different possible locations for the ID and username
const id = profile.info?.sub || profile['sub'];
const username = profile.info?.preferred_username || profile['preferred_username'] || profile['email'] || profile['name'];
if (!id || !username) {
console.error('Could not extract user ID or username from profile', profile);
throw new Error('Invalid user profile data');
}
console.log(`Creating user with id: ${id}, username: ${username}`);
return this.createUser(id, username);
}
}