Compare commits

...
Author SHA1 Message Date
Eduard Gert 5e8048dd20 Push to docker 2024-04-03 13:35:39 +02:00
Eduard Gert 97255dd882 Add logging 2024-04-03 13:33:58 +02:00
4 changed files with 13 additions and 5 deletions

No files matched your search

+2 -1
View File
@@ -4,6 +4,7 @@ on:
branches: branches:
- "feature/**" - "feature/**"
- main - main
- debug
tags: tags:
- "**" - "**"
pull_request: pull_request:
@@ -55,7 +56,7 @@ jobs:
with: with:
context: . context: .
file: docker/Dockerfile file: docker/Dockerfile
push: ${{ github.event_name != 'pull_request' }} push: true
platforms: linux/amd64,linux/arm64,linux/arm platforms: linux/amd64,linux/arm64,linux/arm
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
+1 -1
View File
@@ -34,7 +34,7 @@ const auth0AuthorityConfig: AuthorityConfiguration = {
const onEvent = (configurationName: any, eventName: any, data: any) => { const onEvent = (configurationName: any, eventName: any, data: any) => {
if (process.env.NODE_ENV !== "production") { if (process.env.NODE_ENV !== "production") {
//console.info(`oidc:${configurationName}:${eventName}`, data); console.info(`oidc:${configurationName}:${eventName}`, data);
} }
}; };
+7 -1
View File
@@ -1,4 +1,5 @@
import { OidcSecure, useOidc } from "@axa-fr/react-oidc"; import { OidcSecure, useOidc } from "@axa-fr/react-oidc";
import loadConfig from "@utils/config";
import { usePathname } from "next/navigation"; import { usePathname } from "next/navigation";
import * as React from "react"; import * as React from "react";
import { useEffect } from "react"; import { useEffect } from "react";
@@ -6,13 +7,18 @@ import { useEffect } from "react";
type Props = { type Props = {
children: React.ReactNode; children: React.ReactNode;
}; };
const config = loadConfig();
export const SecureProvider = ({ children }: Props) => { export const SecureProvider = ({ children }: Props) => {
const { isAuthenticated, login } = useOidc(); const { isAuthenticated, login } = useOidc();
const currentPath = usePathname(); const currentPath = usePathname();
useEffect(() => { useEffect(() => {
console.log("isAuthenticated", isAuthenticated);
if (!isAuthenticated) { if (!isAuthenticated) {
login(currentPath); console.info("Not authenticated, logging in...");
login(currentPath, { client_id: config.clientId });
} }
}, [currentPath, isAuthenticated, login]); }, [currentPath, isAuthenticated, login]);
+3 -2
View File
@@ -160,11 +160,12 @@ export function useApiErrorHandling(ignoreError = false) {
}; };
return (err: ErrorResponse) => { return (err: ErrorResponse) => {
console.info("API request error", err);
if (err.code == 401 && err.message == "no valid authentication provided") { if (err.code == 401 && err.message == "no valid authentication provided") {
return login(currentPath); return login(currentPath, { client_id: config.clientId });
} }
if (err.code == 401 && err.message == "token expired") { if (err.code == 401 && err.message == "token expired") {
return login(currentPath); return login(currentPath, { client_id: config.clientId });
} }
if (err.code == 401 && err.message == "token invalid") { if (err.code == 401 && err.message == "token invalid") {
return setError(err); return setError(err);