Support email whitlisting
This commit is contained in:
@ -65,6 +65,7 @@ If you already have a Keycloak custom theme, it can be easily ported to Keycloak
|
|||||||
- [Possible workarounds](#possible-workarounds)
|
- [Possible workarounds](#possible-workarounds)
|
||||||
- [Implement context persistence (optional)](#implement-context-persistence-optional)
|
- [Implement context persistence (optional)](#implement-context-persistence-optional)
|
||||||
- [Kickstart video](#kickstart-video)
|
- [Kickstart video](#kickstart-video)
|
||||||
|
- [Email domain whitelist](#email-domain-whitelist)
|
||||||
|
|
||||||
# How to use
|
# How to use
|
||||||
|
|
||||||
@ -342,3 +343,8 @@ flash of the blank html before the js bundle have been evaluated
|
|||||||
|
|
||||||
*NOTE: keycloak-react-theming was renamed keycloakify since this video was recorded*
|
*NOTE: keycloak-react-theming was renamed keycloakify since this video was recorded*
|
||||||
[](https://youtu.be/xTz0Rj7i2v8)
|
[](https://youtu.be/xTz0Rj7i2v8)
|
||||||
|
|
||||||
|
# Email domain whitelist
|
||||||
|
|
||||||
|
If you want to restrict the emails domain that can register, you can use [this plugin](https://github.com/micedre/keycloak-mail-whitelisting)
|
||||||
|
and `kcRegisterContext["authorizedMailDomains"]` to validate on.
|
||||||
|
@ -147,6 +147,43 @@
|
|||||||
<#recover>
|
<#recover>
|
||||||
</#attempt>
|
</#attempt>
|
||||||
|
|
||||||
})()
|
})(),
|
||||||
|
"authorizedMailDomains": (function (){
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
return "${authorizedMailDomains!''}" || undefined;
|
||||||
|
<#recover>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
})(),
|
||||||
|
"authorizedMailDomains": (function(){
|
||||||
|
|
||||||
|
var out = undefined;
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
<#if authorizedMailDomains??>
|
||||||
|
|
||||||
|
out = [];
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
<#list authorizedMailDomains as authorizedMailDomain>
|
||||||
|
out.push((function (){
|
||||||
|
|
||||||
|
<#attempt>
|
||||||
|
return "${authorizedMailDomain}";
|
||||||
|
<#recover>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
})());
|
||||||
|
</#list>
|
||||||
|
<#recover>
|
||||||
|
</#attempt>
|
||||||
|
</#if>
|
||||||
|
<#recover>
|
||||||
|
</#attempt>
|
||||||
|
|
||||||
|
return out;
|
||||||
|
|
||||||
|
})(),
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
@ -124,6 +124,7 @@ export declare namespace KcContext {
|
|||||||
passwordRequired: boolean;
|
passwordRequired: boolean;
|
||||||
recaptchaRequired: boolean;
|
recaptchaRequired: boolean;
|
||||||
recaptchaSiteKey?: string;
|
recaptchaSiteKey?: string;
|
||||||
|
authorizedMailDomains?: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Info = Common & {
|
export type Info = Common & {
|
||||||
|
@ -153,7 +153,7 @@ export const kcRegisterContext: KcContext.Register = {
|
|||||||
"registrationAction": "http://localhost:8080/auth/realms/myrealm/login-actions/registration?session_code=gwZdUeO7pbYpFTRxiIxRg_QtzMbtFTKrNu6XW_f8asM&execution=12146ce0-b139-4bbd-b25b-0eccfee6577e&client_id=account&tab_id=uS8lYfebLa0"
|
"registrationAction": "http://localhost:8080/auth/realms/myrealm/login-actions/registration?session_code=gwZdUeO7pbYpFTRxiIxRg_QtzMbtFTKrNu6XW_f8asM&execution=12146ce0-b139-4bbd-b25b-0eccfee6577e&client_id=account&tab_id=uS8lYfebLa0"
|
||||||
},
|
},
|
||||||
"messagesPerField": {
|
"messagesPerField": {
|
||||||
"printIfExists": (...[,x]) => x
|
"printIfExists": (...[, x]) => x
|
||||||
},
|
},
|
||||||
"scripts": [],
|
"scripts": [],
|
||||||
"isAppInitiatedAction": false,
|
"isAppInitiatedAction": false,
|
||||||
@ -162,10 +162,17 @@ export const kcRegisterContext: KcContext.Register = {
|
|||||||
"formData": {}
|
"formData": {}
|
||||||
},
|
},
|
||||||
"passwordRequired": true,
|
"passwordRequired": true,
|
||||||
"recaptchaRequired": false
|
"recaptchaRequired": false,
|
||||||
|
"authorizedMailDomains": [
|
||||||
|
"example.com",
|
||||||
|
"another-example.com",
|
||||||
|
"*.yet-another-example.com",
|
||||||
|
"*.example.com",
|
||||||
|
"hello-world.com"
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const kcInfoContext: KcContext.Info ={
|
export const kcInfoContext: KcContext.Info = {
|
||||||
...kcCommonContext,
|
...kcCommonContext,
|
||||||
"pageId": "info.ftl",
|
"pageId": "info.ftl",
|
||||||
"messageHeader": "<Message header>",
|
"messageHeader": "<Message header>",
|
||||||
@ -188,7 +195,7 @@ export const kcErrorContext: KcContext.Error = {
|
|||||||
export const kcLoginResetPasswordContext: KcContext.LoginResetPassword = {
|
export const kcLoginResetPasswordContext: KcContext.LoginResetPassword = {
|
||||||
...kcCommonContext,
|
...kcCommonContext,
|
||||||
"pageId": "login-reset-password.ftl",
|
"pageId": "login-reset-password.ftl",
|
||||||
"realm":{
|
"realm": {
|
||||||
...kcCommonContext.realm,
|
...kcCommonContext.realm,
|
||||||
"loginWithEmailAllowed": false
|
"loginWithEmailAllowed": false
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user