Use getAlgorithmKey in account
This commit is contained in:
parent
8e01d836a9
commit
4cae1c673c
@ -166,6 +166,7 @@ export declare namespace KcContext {
|
|||||||
algorithm: "HmacSHA1" | "HmacSHA256" | "HmacSHA512";
|
algorithm: "HmacSHA1" | "HmacSHA256" | "HmacSHA512";
|
||||||
digits: number;
|
digits: number;
|
||||||
lookAheadWindow: number;
|
lookAheadWindow: number;
|
||||||
|
getAlgorithmKey: () => string;
|
||||||
} & (
|
} & (
|
||||||
| {
|
| {
|
||||||
type: "totp";
|
type: "totp";
|
||||||
|
@ -148,7 +148,8 @@ export const kcContextMocks: KcContext[] = [
|
|||||||
digits: 6,
|
digits: 6,
|
||||||
lookAheadWindow: 1,
|
lookAheadWindow: 1,
|
||||||
type: "totp",
|
type: "totp",
|
||||||
period: 30
|
period: 30,
|
||||||
|
getAlgorithmKey: () => "SHA1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mode: "qr",
|
mode: "qr",
|
||||||
|
@ -16,12 +16,6 @@ export default function Totp(props: PageProps<Extract<KcContext, { pageId: "totp
|
|||||||
|
|
||||||
const { msg, msgStr, advancedMsg } = i18n;
|
const { msg, msgStr, advancedMsg } = i18n;
|
||||||
|
|
||||||
const algToKeyUriAlg: Record<(typeof kcContext)["totp"]["policy"]["algorithm"], string> = {
|
|
||||||
HmacSHA1: "SHA1",
|
|
||||||
HmacSHA256: "SHA256",
|
|
||||||
HmacSHA512: "SHA512"
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Template {...{ kcContext, i18n, doUseDefaultCss, classes }} active="totp">
|
<Template {...{ kcContext, i18n, doUseDefaultCss, classes }} active="totp">
|
||||||
<>
|
<>
|
||||||
@ -100,7 +94,7 @@ export default function Totp(props: PageProps<Extract<KcContext, { pageId: "totp
|
|||||||
{msg("totpType")}: {msg(`totp.${totp.policy.type}`)}
|
{msg("totpType")}: {msg(`totp.${totp.policy.type}`)}
|
||||||
</li>
|
</li>
|
||||||
<li id="kc-totp-algorithm">
|
<li id="kc-totp-algorithm">
|
||||||
{msg("totpAlgorithm")}: {algToKeyUriAlg?.[totp.policy.algorithm] ?? totp.policy.algorithm}
|
{msg("totpAlgorithm")}: {totp.policy.getAlgorithmKey()}
|
||||||
</li>
|
</li>
|
||||||
<li id="kc-totp-digits">
|
<li id="kc-totp-digits">
|
||||||
{msg("totpDigits")}: {totp.policy.digits}
|
{msg("totpDigits")}: {totp.policy.digits}
|
||||||
|
@ -305,12 +305,14 @@ function decodeHtmlEntities(htmlStr){
|
|||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if are_same_path(path, ["totp", "policy", "getAlgorithmKey"])>
|
<#if are_same_path(path, ["totp", "policy", "getAlgorithmKey"])>
|
||||||
<#local returnValue = "">
|
<#local returnValue = "error">
|
||||||
|
<#if mode?? && mode = "manual">
|
||||||
<#attempt>
|
<#attempt>
|
||||||
<#local returnValue = totp.policy.getAlgorithmKey()>
|
<#local returnValue = totp.policy.getAlgorithmKey()>
|
||||||
<#recover>
|
<#recover>
|
||||||
<#return "ABORT: Couldn't evaluate totp.policy.getAlgorithmKey()">
|
<#return "ABORT: Couldn't evaluate totp.policy.getAlgorithmKey()">
|
||||||
</#attempt>
|
</#attempt>
|
||||||
|
</#if>
|
||||||
<#return 'function(){ return "' + returnValue + '"; }'>
|
<#return 'function(){ return "' + returnValue + '"; }'>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user