[midPoint] Ambiguous method overloading

Wojciech Staszewski wojciech.staszewski at diagnostyka.pl
Tue Oct 16 11:31:41 CEST 2018


Hi Arnošt!

Thank you very much. I added a condition for checking __PASSWORD__ against NULL values in my Groovy scripts ant the errors are gone,
but I'm afraid that this is more workaround than solution. The question is "why the password value is null, if it's not?"
Every midPoint user has password set.

The groovy scripts already have conditions:

for (attr in accountAttrNames) {
             if (attributes.get(attr) != null) {
                 switch (attr) {

that should prevent passing null attribute values.
Hmmm....

Thanks and regards!
WS

W dniu 15.10.2018 o 22:20, Arnošt Starosta - AMI Praha a.s. pisze:
> Hi Wojciech,
> 
> the code is sometimes passing null value (as the result of attributes?.get() call) to SecurityUtils.decrypt and there are two methods of this name in SecurityUtils. One takes GuardedByteArray and the other GuardedString as parameter.
> 
> As null has no type in java, the jvm does not know which method to call.
> 
> Check for null values before calling decrypt and you are ok.
> 
> arnost
> 
> po 15. 10. 2018 v 22:04 odesílatel Wojciech Staszewski <wojciech.staszewski at diagnostyka.pl <mailto:wojciech.staszewski at diagnostyka.pl>> napsal:
> 
>     Hello!
> 
>     What can be the cause of this error message:
> 
>     Can't process shadow: null (OID:null): Generic error in connector:
>     groovy.lang.GroovyRuntimeException(Ambiguous method overloading for
>     method
>     org.identityconnectors.common.security.SecurityUtil#decrypt.?Cannot
>     resolve which method to invoke for [null] due to overlapping prototypes
>     between:??[class
>     org.identityconnectors.common.security.GuardedByteArray]??[class
>     org.identityconnectors.common.security.GuardedString])
> 
>     This error shows up randomly in the reconciliation tasks and always is
>     related to ScriptedSQL resources.
> 
>     I have outbound password mapping, this is the Groovy script part
>     responsible for password handling:
> 
>     case "__PASSWORD__":
>          // Read user password as clear text, then make sha1 hash with salt
>          def SALT =
>     org.apache.commons.lang.RandomStringUtils.randomAlphanumeric(8);
>          def clearpass =
>     SecurityUtil.decrypt(attributes?.get("__PASSWORD__")?.get(0)).toString()
>     + SALT;
>          String.metaClass.toSHA1 = { salt = "" ->
>          def messageDigest = MessageDigest.getInstance("SHA1")
>          messageDigest.update(salt.getBytes())
>          messageDigest.update(delegate.getBytes())
>          new BigInteger(1, messageDigest.digest()).toString(16).padLeft(40, '0')
>          }
>          sha1pass = clearpass.toSHA1('');
>          sql.executeUpdate("UPDATE users SET password=?, salt=? WHERE
>     user_id=?",[sha1pass,SALT,uid]);
>     break;
> 
>     Thanks for any tips.
>     Regards,
>     WS
> 
>     -- 
>     Wojciech Staszewski
>     Administrator Systemów Sieciowych
>     www.diagnostyka.pl <http://www.diagnostyka.pl>
>     Diagnostyka Sp. z o. o.
>     ul. Prof. M. Życzkowskiego 16, 31-864 Kraków
>     Numer KRS: 0000381559 (Sąd Rejonowy dla Krakowa-Śródmieścia w Krakowie, XI Wydział Gospodarczy KRS)
>     NIP: 675-12-65-009; REGON: 356366975
>     Kapitał zakładowy: 33 756 500 zł.
> 
>     Pomyśl o środowisku zanim wydrukujesz ten e-mail.
> 
>     _______________________________________________
>     midPoint mailing list
>     midPoint at lists.evolveum.com <mailto:midPoint at lists.evolveum.com>
>     http://lists.evolveum.com/mailman/listinfo/midpoint
> 
> 
> 
> -- 
> 
> *Arnošt Starosta*
> solution architect
> gsm: [+420] 603 794 932
> e‑mail: arnost.starosta at ami.cz <mailto:arnost.starosta at ami.cz>
> *AMI Praha a.s.*
> Pláničkova 11, 162 00 Praha 6
> tel.: [+420] 274 783 239 | web: www.ami.cz <http://dtp.ami.cz/www.ami.cz>
> AMI Praha a.s.
> Textem tohoto e‑mailu podepisující neslibuje uzavřít ani neuzavírá za společnost AMI Praha a.s. jakoukoliv smlouvu. Každá smlouva, pokud bude uzavřena, musí mít výhradně písemnou formu.
> Tento e‑mail je určen výhradně pro potřeby jeho adresáta/ů a může obsahovat důvěrné nebo osobní informace. Nejste‑li zamýšleným příjemcem, je zakázáno jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto informací. Pokud jste obdrželi e‑mail neoprávněně, informujte o tom prosím odesílatele a vymažte neprodleně všechny kopie tohoto e‑mailu včetně všech jeho příloh. Nakládáním s neoprávněně získanými informacemi se vystavujete riziku právního postihu.
> 
> 
> 
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
> 

-- 
Wojciech Staszewski
Administrator Systemów Sieciowych
www.diagnostyka.pl
Diagnostyka Sp. z o. o.
ul. Prof. M. Życzkowskiego 16, 31-864 Kraków
Numer KRS: 0000381559 (Sąd Rejonowy dla Krakowa-Śródmieścia w Krakowie, XI Wydział Gospodarczy KRS)
NIP: 675-12-65-009; REGON: 356366975
Kapitał zakładowy: 33 756 500 zł.

Pomyśl o środowisku zanim wydrukujesz ten e-mail.



More information about the midPoint mailing list