Main Content

Magnolia Community Forums: Get help with Magnolia: Magnolia "custom" user login

  • matteo.pelucco
    Full name: Matteo Pelucco
    Posts: 264
    Last post: Mar 20, 2017 9:27:06 AM
    Magnolia "custom" user login
    #1 by matteo.pelucco on Mar 13, 2017 3:15:16 PM

    Hi all,
    before starting digging the code, I ask the community.

    In a new project, we have 3 types of public user authentication. 2 of them should try to do a Magnolia login in an explicit way. In other words, we expect a standard Magnolia component to perform a login.
    No jaas, no "standard" external user login: a simple component that based on some condition, run an execute() method and at the end, user is logged.

    No Magnolia users inside users repo. Only virtual users.

    Any indication?
    Thanks in advance,

  • matteo.pelucco
    Full name: Matteo Pelucco
    Posts: 264
    Last post: Mar 20, 2017 9:27:06 AM
    Re: Magnolia "custom" user login
    #2 by matteo.pelucco on Mar 13, 2017 3:52:17 PM

    Just to explain better...
    Imagine to be in a component model class, inside "execute" method.

    you have this code:

    final String username = "matteo.pelucco";
    final List<String> groups = new LinkedList<String>();
    final String mail = "";
    final String fullName = "Matteo Pelucco";

    now, how can I have a MgnlUser "Matteo Pelucco" (with groups) logged in Magnolia WITHOUT having that user in users workspace?

    In this moment, I can only think about having a redirect to the same page, adding some control parameters in the URL and to have a standard JAAS chain to handle that.. but I am wondering if there are some API I can call, like:

    UserManager um = getUserManager();
    um.login(new MyUser(username, email, groups, ...);

    Thanks again,

  • jdiepeveen
    Full name: Jordie Diepeveen
    Posts: 4
    Last post: Oct 2, 2017 4:13:22 PM
    Re: Magnolia "custom" user login
    #3 by jdiepeveen on Mar 24, 2017 8:15:39 PM

    Hi Matteo,

    You can use the ExternalUser and ExternalUserManager for user which are not stored in Magnolia (e.g. user stored in LDAP or AD).

    Try creating your owner implementation of the ExternalUserManager and ExternalUser. By creation your own realm in config:/server/security/userManagers/ and setting your own UserManager, your login request will be handled. Within the UserManager you can assign roles/groups present in Magnolia to the external user.

    To 'hook' into the default login mechanism, your login form just needs to fields: mgnlUserId, mgnlUserPSWD (see inside a <form> which will be submitted to e.g. the same page. The login request will go through the filter chain, will be picked up and will be delegated to the UserManager.

    See also:

You don't have the permission to post on this thread

Sign in

To login on this forum, you can use your Magnolia Forge, Support or Partner account, or, below, your Google, Yahoo! or OpenID account. If you have trouble logging in, or any other sort of issue, please let us know in the Meta forum, on the user-list, or simply by email at forum-admin at magnolia-cms dot com.

* Required

... or sign in with:

  • icon http://{your-openid-url}
  • icon
  • icon