[midPoint] [External] Re: New User Password Creation Prompt

Drew Roberts aroberts at apu.edu
Wed Nov 29 17:26:14 CET 2023


Hey Sven, thanks! I'll give that a try.

Pascal, I actually made a mistake with my code example! I was trying so
many things that I copied the wrong code snippet. I've actually been trying
createPasswordResetLink and the token shows up as null so I get something
like this: https://$host/midpoint/auth/passwordSet?user=testuser&token=null
I think the general notifier probably just doesn't work with
createPasswordResetLink because the nonce doesn't get generated and added
to the user credentials. I was hoping I could set something up so that when
a user received a role, they would get prompted to make a password. Since
there didn't seem to be a notifier/nonce setup for a first-time password
setup I was messing with createPasswordResetLink. I suppose I could
generate the nonce manually somehow, but I'm not sure what function would
be needed to add the nonce credential to a user manually.


On Wed, Nov 29, 2023 at 2:33 AM Sven Feyerabend via midPoint <
midpoint at lists.evolveum.com> wrote:

> Hi,
>
> I use the self post-registration feature (
> https://docs.evolveum.com/midpoint/reference/support-4.8/misc/self-registration/
> )
>
> For this I have a simpleUserNotifier:
>
> <simpleUserNotifier>
>     <operation>add</operation>
>     <subjectExpression>
>         <script>
>             <code>
>                 return 'Subject'
>             </code>
>         </script>
>     </subjectExpression>
>     <expressionFilter>
>         <script>
>             <code>
>
> basic.stringify(requestee?.lifecycleState).equals('proposed')
>             </code>
>         </script>
>     </expressionFilter>
>     <recipientExpression>
>         <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> <http://www.w3.org/2001/XMLSchema-instance>
>                 xsi:type="c:ScriptExpressionEvaluatorType">
>             <code>
>                 return requestee.getEmailAddress()
>             </code>
>         </script>
>     </recipientExpression>
>     <bodyExpression>
>         <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> <http://www.w3.org/2001/XMLSchema-instance>
>                 xsi:type="c:ScriptExpressionEvaluatorType">
>             <code>
>                 import
> com.evolveum.midpoint.notifications.api.events.ModelEvent
>
>                 modelEvent = (ModelEvent) event
>                 newUser = modelEvent.getFocusContext().getObjectNew();
>                 userType = newUser.asObjectable();
>                 link = midpoint.createInvitationLink(userType);
>                 bodyMessage = // insert appropriate message containing the
> link
>                 return bodyMessage;
>             </code>
>         </script>
>     </bodyExpression>
>     <transport>mail</transport>
> </simpleUserNotifier>
> Then I have an ObjectTemplate that ensures new Users are created with
> lifecycleState "proposed".
> There is some additional configuration required, but that is the heart of
> it.
>
> I hope this helps.
>
> Kind regards,
> Sven
>
> Am 28.11.23 um 17:45 schrieb Drew Roberts via midPoint:
>
> What process do you guys use to prompt a newly created user to make a
> password? I've tried doing something like
>
>> def user = (event as ModelEvent).focusContext.objectNew?.asObjectable()
>> as UserType
>> def link = midpoint.createAccountActivationLink(user)
>>
> inside a general notifier to send a mail nonce but I get a null token when
> I do that so I'm guessing I'm doing it wrong.
>
> --
> Drew Roberts  |  Systems Administrator II
> IT Platform Engineering, Azusa Pacific University
> apu.edu
>
> [image: APU logo]
>
> _______________________________________________
> midPoint mailing listmidPoint at lists.evolveum.comhttps://lists.evolveum.com/mailman/listinfo/midpoint
>
> --
> Sven Feyerabend
> Referent für IT-Betreuung
> stuvus – Studierendenvertretung Universität Stuttgart
> Pfaffenwaldring 5c
> 70569 Stuttgart
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint
>


-- 
Drew Roberts  |  Systems Administrator II
IT Platform Engineering, Azusa Pacific University
apu.edu

[image: APU logo]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20231129/7d076fd5/attachment.htm>


More information about the midPoint mailing list