2024-06-09 08:27:07 +02:00
|
|
|
import { getKcClsx } from "keycloakify/login/lib/kcClsx";
|
2024-06-05 21:13:58 +02:00
|
|
|
import { PageProps } from "keycloakify/login/pages/PageProps";
|
|
|
|
import { KcContext } from "../KcContext";
|
2024-06-09 11:20:45 +02:00
|
|
|
import type { I18n } from "../i18n";
|
2023-11-03 16:06:46 -04:00
|
|
|
|
2024-06-09 11:20:45 +02:00
|
|
|
export default function LoginOauthGrant(props: PageProps<Extract<KcContext, { pageId: "login-oauth-grant.ftl" }>, I18n>) {
|
|
|
|
const { kcContext, i18n, doUseDefaultCss, classes, Template } = props;
|
2023-11-03 16:06:46 -04:00
|
|
|
const { url, oauth, client } = kcContext;
|
|
|
|
|
2024-06-09 11:20:45 +02:00
|
|
|
const { msg, msgStr, advancedMsg, advancedMsgStr } = i18n;
|
2023-11-03 16:06:46 -04:00
|
|
|
|
2024-06-09 08:27:07 +02:00
|
|
|
const { kcClsx } = getKcClsx({
|
2023-11-03 16:06:46 -04:00
|
|
|
doUseDefaultCss,
|
|
|
|
classes
|
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Template
|
2024-06-09 08:27:07 +02:00
|
|
|
kcContext={kcContext}
|
2024-06-09 11:20:45 +02:00
|
|
|
i18n={i18n}
|
2024-06-09 08:27:07 +02:00
|
|
|
doUseDefaultCss={doUseDefaultCss}
|
|
|
|
classes={classes}
|
2024-05-11 00:47:18 +02:00
|
|
|
bodyClassName="oauth"
|
|
|
|
headerNode={
|
|
|
|
<>
|
|
|
|
{client.attributes.logoUri && <img src={client.attributes.logoUri} />}
|
|
|
|
<p>{client.name ? msg("oauthGrantTitle", advancedMsgStr(client.name)) : msg("oauthGrantTitle", client.clientId)}</p>
|
|
|
|
</>
|
|
|
|
}
|
2023-11-03 16:06:46 -04:00
|
|
|
>
|
|
|
|
<div id="kc-oauth" className="content-area">
|
|
|
|
<h3>{msg("oauthGrantRequest")}</h3>
|
|
|
|
<ul>
|
|
|
|
{oauth.clientScopesRequested.map(clientScope => (
|
|
|
|
<li key={clientScope.consentScreenText}>
|
2024-05-11 00:47:18 +02:00
|
|
|
<span>
|
|
|
|
{advancedMsg(clientScope.consentScreenText)}
|
|
|
|
{clientScope.dynamicScopeParameter && (
|
|
|
|
<>
|
|
|
|
: <b>{clientScope.dynamicScopeParameter}</b>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</span>
|
2023-11-03 16:06:46 -04:00
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
|
2024-05-11 00:47:18 +02:00
|
|
|
{client.attributes.policyUri ||
|
|
|
|
(client.attributes.tosUri && (
|
|
|
|
<h3>
|
|
|
|
{client.name ? msg("oauthGrantInformation", advancedMsgStr(client.name)) : msg("oauthGrantInformation", client.clientId)}
|
|
|
|
{client.attributes.tosUri && (
|
|
|
|
<>
|
|
|
|
{msg("oauthGrantReview")}
|
|
|
|
<a href={client.attributes.tosUri} target="_blank">
|
|
|
|
{msg("oauthGrantTos")}
|
|
|
|
</a>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
{client.attributes.policyUri && (
|
|
|
|
<>
|
|
|
|
{msg("oauthGrantReview")}
|
|
|
|
<a href={client.attributes.policyUri} target="_blank">
|
|
|
|
{msg("oauthGrantPolicy")}
|
|
|
|
</a>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</h3>
|
|
|
|
))}
|
|
|
|
|
2023-11-03 16:06:46 -04:00
|
|
|
<form className="form-actions" action={url.oauthAction} method="POST">
|
|
|
|
<input type="hidden" name="code" value={oauth.code} />
|
2024-06-09 08:27:07 +02:00
|
|
|
<div className={kcClsx("kcFormGroupClass")}>
|
2023-11-03 16:06:46 -04:00
|
|
|
<div id="kc-form-options">
|
2024-06-09 08:27:07 +02:00
|
|
|
<div className={kcClsx("kcFormOptionsWrapperClass")}></div>
|
2023-11-03 16:06:46 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="kc-form-buttons">
|
2024-06-09 08:27:07 +02:00
|
|
|
<div className={kcClsx("kcFormButtonsWrapperClass")}>
|
2023-11-03 16:06:46 -04:00
|
|
|
<input
|
2024-06-09 08:27:07 +02:00
|
|
|
className={kcClsx("kcButtonClass", "kcButtonPrimaryClass", "kcButtonLargeClass")}
|
2023-11-03 16:06:46 -04:00
|
|
|
name="accept"
|
|
|
|
id="kc-login"
|
|
|
|
type="submit"
|
|
|
|
value={msgStr("doYes")}
|
|
|
|
/>
|
|
|
|
<input
|
2024-06-09 08:27:07 +02:00
|
|
|
className={kcClsx("kcButtonClass", "kcButtonDefaultClass", "kcButtonLargeClass")}
|
2023-11-03 16:06:46 -04:00
|
|
|
name="cancel"
|
|
|
|
id="kc-cancel"
|
|
|
|
type="submit"
|
|
|
|
value={msgStr("doNo")}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<div className="clearfix"></div>
|
|
|
|
</div>
|
|
|
|
</Template>
|
|
|
|
);
|
|
|
|
}
|