Managing users with auth0 for jenkins

We are using auth0 for jenkins login and some other tools
Is there any way that we can restrict specific user in authzero to access only jenkins

Hi @pratap.gudimetla,

Welcome to the Auth0 Community!

Yes, you can control who has access to your application by using a Post-Login Action.

In the script, you can create a list of whitelisted users who are allowed access.

For example:

/**
 * @param {Event} event - Details about the user and the context in which they are logging in.
 * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
 */
exports.onExecutePostLogin = async (event, api) => {
  const whitelist = ["testuser@example", "testuser2@example.com"]
  if (!whitelist.includes(event.user.email)) {
    api.access.deny('invalid_request', "Access from your email address is not allowed.");
  }
};

I hope this helps!

Please let me know how this works for you.

Thanks,
Rueben

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