[midPoint] Generate credentials through object template

Pavol Mederly mederly at evolveum.com
Thu Aug 4 08:35:08 CEST 2016


Hello Jason,

The Java code is almost OK - I would just change "> 0" to ">= 2" 
or ">= 4" (i.e. >=2, >=4) in first two and the third line, 
respectively, in order to threat short names/UIDnumber that would lead 
to IndexOutOfBoundsException.

And, as for the target path: It's hard to say. The way you've chosen 
seems to be logical. This part of midPoint is not much documented, so 
the only documentation is the code. And the code that implements 
credentials mappings is quite old and in some aspects not adequate (as 
I've learned recently), so it will be probably changed in near future. 
Therefore we are on thin ice here.

My suggestion: leave it as it is (if it's working). Maybe you could test 
it on a user that has no password at all, if it works also in this 
situation. And before any upgrade of midPoint (e.g. to 3.4.1 or 3.5), 
just retest it.

I've created a JIRA issue for this (MID-3330 
<https://jira.evolveum.com/browse/MID-3330>). It's not a much work, but 
most probably it would require a request of a subscriber or a little 
sponsoring.

Best regards,

-- 
Pavol Mederly
Software developer
evolveum.com


On 28.07.2016 21:02, Jason Everling wrote:
> I need to generate new temp credentials for returning users that have 
> not used their account for years, most of them do not remember their 
> security questions or they have changed mobile phone numbers so they 
> cannot utilize our forgotten password process.
>
> I have tested the below and it seems to be working, but since I am not 
> a java guru I am not 100% confident it is correct. Can someone 
> confirm? Mainly the target path
>
>    <!-- example josm5983 -->
>    <mapping>
>       <source>
>  <name>tmpGivenName</name>
>  <path>$user/givenName</path>
>       </source>
>       <source>
>  <name>tmpFamilyName</name>
>  <path>$user/familyName</path>
>       </source>
>       <source>
>  <name>tmpUidnumber</name>
>          <path>
> declare namespace bshp='http://midpoint.bshp.edu/schema/bshp';
> $c:user/c:extension/bshp:uidnumber
> </path>
>       </source>
>       <expression>
>          <script>
>             <code>
> tmpGivenNameInit = basic.stringify(tmpGivenName)?.size() > 0 ? 
> (basic.stringify(tmpGivenName)).substring(0,2) : ''
> tmpFamilyNameInit = basic.stringify(tmpFamilyName)?.size() > 0 ? 
> (basic.stringify(tmpFamilyName)).substring(0,2) : ''
> tmptmpUidnumberInit = basic.stringify(tmpUidnumber)?.size() > 0 ? 
> (basic.stringify(tmpUidnumber)).substring(0,4) : ''
>
> newPasswd = basic.norm(tmpGivenNameInit + tmpFamilyNameInit + 
> tmptmpUidnumberInit)
>
> basic.encrypt(newPasswd)
> </code>
>          </script>
>       </expression>
>       <target>
>  <path>credentials/password/value</path>
>       </target>
>    </mapping>
>
>
>
> CONFIDENTIALITY NOTICE:
> This e-mail together with any attachments is proprietary and 
> confidential; intended for only the recipient(s) named above and may 
> contain information that is privileged. You should not retain, copy or 
> use this e-mail or any attachments for any purpose, or disclose all or 
> any part of the contents to any person. Any views or opinions 
> expressed in this e-mail are those of the author and do not represent 
> those of the Baptist School of Health Professions. If you have 
> received this e-mail in error, or are not the named recipient(s), you 
> are hereby notified that any review, dissemination, distribution or 
> copying of this communication is prohibited by the sender and to do so 
> might constitute a violation of the Electronic Communications Privacy 
> Act, 18 U.S.C. section 2510-2521. Please immediately notify the sender 
> and delete this e-mail and any attachments from your computer.
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20160804/44492b23/attachment.htm>


More information about the midPoint mailing list