# Possibility of custom Login validation logic

**URL:** <https://community.auth0.com/t/possibility-of-custom-login-validation-logic/118614>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [October 16, 2023, 10:16am UTC](https://community.auth0.com/t/possibility-of-custom-login-validation-logic/118614 "2023-10-16T10:16:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lingjun.jiang](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@lingjun.jiang](https://community.auth0.com/u/lingjun.jiang)\
**Post date:** [October 16, 2023, 10:16am UTC](https://community.auth0.com/t/possibility-of-custom-login-validation-logic/118614/1 "2023-10-16T10:16:20Z")

</div>

Dear all, we have a requirement which needs to deny login when a user expires, e.g., there is a custom date property named valid\_until on user\_metadata. If the user doesn’t expire, then it would be able to login to an application via SSO configuration (SAML enabled). To implement this, we created an Action in the PostLogin flow to use api.access.deny() method when today exceeds the valid\_until. However, even a user is expired, the user still logs in Auth0 successfully and be redirected to the SSO application (with wrong SAML assertion), but from monitoring log, it shows Login Failed with the error message which is defined in the api.access.deny() method. What is expected is the user should not be logged in Auth0 or redirected to that SSO application at all. We tried customizing the login from with either Lock widget or Auth0.js, it turned out the same. So was wondering if it’s possible to add specific login validation logic as such in additional to normal username password validation only?  
Thanks in advance for any help or hint.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [October 20, 2023, 7:17pm UTC](https://community.auth0.com/t/possibility-of-custom-login-validation-logic/118614/3 "2023-10-20T19:17:06Z")

</div>

Hi @lingjun.jiang,

Welcome to the Auth0 Community!

Can you give an example of what a “wrong SAML assertion” is? What are they returned when they are denied login?

Also, can you please share the code of your Action?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 8, 2023, 4:11pm UTC](https://community.auth0.com/t/possibility-of-custom-login-validation-logic/118614/4 "2023-11-08T16:11:02Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
