[midPoint] Use CSV for validate user

Sylvaire kevin TIPA sylvaire-kevin.tipa at mythalesgroup.io
Wed Apr 18 09:46:06 CEST 2018


I reply to myself if someone else search this information, here the java code for check in resource (it's really simple at the end :p )


def edirRessource = midpoint.searchObjectByName(ResourceType.class, "edir-CSV")

 ResourceSchema resourceSchema = RefinedResourceSchemaImpl.getResourceSchema(edirRessource, prismContext);
                                    ObjectClassComplexTypeDefinition objectClassDef = resourceSchema.findObjectClassDefinition(SchemaConstants.ACCOUNT_OBJECT_CLASS_LOCAL_NAME);

                                    qnameMail = new QName(edirRessource.getNamespace(), "MAIL")

                                    ObjectQuery query = QueryBuilder.queryFor(ShadowType.class, prismContext)
                                          .item(ShadowType.F_RESOURCE_REF).ref(edirRessource.getOid())
                                          .and()
                                          .item(ShadowType.F_OBJECT_CLASS).eq(new QName(edirRessource.getNamespace(), "AccountObjectClass"))
                                          .and()
                                          .item(new ItemPath(ShadowType.F_ATTRIBUTES, SchemaConstants.ICFS_NAME),objectClassDef.findAttributeDefinition(SchemaConstants.ICFS_NAME)).eq(user.getName().toString().toUpperCase())
                                          .build();

                                    shadowQueryResult = midpoint.searchObjects(ShadowType.class, query)


                                    if(shadowQueryResult){


                                        for(shadow in shadowQueryResult){

                                            log.info("shadow details : " + ShadowUtil.getAttributeValue(shadow, qnameMail))
                                        }
                                    }



Cordialement.


Sylvaire-Kevin TIPA
Thales Services / OIC INFRAS
Devops Infrastructure Automation

        [cid:48dd5d09-2423-4383-9dc5-7c7fde94b159]





THALES SERVICES SAS
44 Quai Charles de Gaulle
CS 20100
69463 Lyon Cedex 06



--------------------------------------------------
www.thalesgroup.com<http://www.thalesgroup.com>

________________________________
De : midPoint <midpoint-bounces at lists.evolveum.com> de la part de Sylvaire kevin TIPA <sylvaire-kevin.tipa at mythalesgroup.io>
Envoyé : mardi 17 avril 2018 08:24:54
À : midpoint at lists.evolveum.com
Objet : [midPoint] Use CSV for validate user


Cet expéditeur n’a pas passé les vérifications relatives à la détection des fraudes et n’est peut-être pas la personne qu’il prétend être. En savoir plus sur l’ usurpation d’identités<http://aka.ms/LearnAboutSpoofing>
        Votre avis<http://aka.ms/SafetyTipsFeedback>

Hey all,


I want to use a CSV file from my RH system for validate user creation un self registry. For reason, I don't want to import all account by I want to let use create her account, and check if it's present in my file.


So I have imported my CSV file as resource via CSV connector. But how I can use it as check ? I start to make this job in user hook with the following process :
- Check if name exist
- if yes, continue
- if not, sent notification to company admin for check and update the csv file

I have few problem :
- How I can browse the resource in java ?
- I can make a query on shadow, but it seems that all the shadow are not load until I browse the resource with gui ..
  - So, How I can load all the account in shadow item with connect it to account ...


Other idea ?


th, br


Cordialement.


Sylvaire-Kevin TIPA
Thales Services / OIC INFRAS
Devops Infrastructure Automation

        [cid:9c0d85e5-a0d2-4bf9-b80e-e17a720af405]





THALES SERVICES SAS
44 Quai Charles de Gaulle
CS 20100
69463 Lyon Cedex 06



--------------------------------------------------
www.thalesgroup.com<http://www.thalesgroup.com>

This message contains confidential information and is intended only for the individual(s) addressed in the message. If you are not the named addressee, you should not disseminate, distribute, or copy this e-mail. If you are not the intended recipient, you are notified that disclosing, distributing, or copying this e-mail is strictly prohibited.

This message contains confidential information and is intended only for the individual(s) addressed in the message. If you are not the named addressee, you should not disseminate, distribute, or copy this e-mail. If you are not the intended recipient, you are notified that disclosing, distributing, or copying this e-mail is strictly prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20180418/56775bed/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-cj4s2wz0.png
Type: image/png
Size: 6112 bytes
Desc: Outlook-cj4s2wz0.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20180418/56775bed/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-ylep2cgd.png
Type: image/png
Size: 6112 bytes
Desc: Outlook-ylep2cgd.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20180418/56775bed/attachment-0001.png>


More information about the midPoint mailing list