48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { useMsal } from "@azure/msal-react";
|
|
import {
|
|
isMsalConfigured,
|
|
MSAL_API_SCOPE,
|
|
msalInstance,
|
|
} from "../lib/auth/msal.config";
|
|
|
|
function LoginButton() {
|
|
const { instance } = useMsal();
|
|
|
|
return (
|
|
<button
|
|
type="button"
|
|
className="btn btn-primary btn-sm px-5"
|
|
onClick={() =>
|
|
void instance.loginRedirect({
|
|
scopes: [MSAL_API_SCOPE],
|
|
prompt: "select_account",
|
|
})
|
|
}
|
|
>
|
|
Entra ID 로 로그인
|
|
</button>
|
|
);
|
|
}
|
|
|
|
export default function LoginPage() {
|
|
return (
|
|
<main className="max-w-5xl mx-auto px-4 sm:px-6 py-20">
|
|
<div className="max-w-md border border-base-content/10 bg-base-100 p-6 shadow-sm">
|
|
<h1 className="text-xl font-bold tracking-tight">로그인</h1>
|
|
<p className="mt-2 text-sm text-base-content/50">
|
|
Entra ID 계정으로 LOLYMPUS 정보를 불러옵니다.
|
|
</p>
|
|
<div className="mt-5">
|
|
{isMsalConfigured && msalInstance ? (
|
|
<LoginButton />
|
|
) : (
|
|
<div className="text-sm text-amber-600">
|
|
MSAL 환경변수 설정이 필요합니다.
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</main>
|
|
);
|
|
}
|