Good morning,
Il 27/02/2018 17:59, HugoCerdeira ha scritto:
Hi,
I'm making an authentication groovy script my goal is the following flow:
1. Script makes a request to a service sending the user and password.
2. If the request response is successful query the syncope db for the user
id, using the username.
3. Return the user id.
The problem is, since the resource is configured as a REST resource, how can
execute sql queries from the script? is it possible to do that without
having to hardcode the sql connection config into my groovy script?
You do not need to query Syncope database to look for id on Syncope.
Because you only need to return the value of the attribute that, on
Syncope, is mapped as remote key. I mean: if your mapping for remote key
looks like "username -> idattribute" (syncope -> REST resource) you only
need to return the value of idattribute on REST resource. Syncope will
take care of look (on the REST resource) if id is correct by using the
mapping.
P.S. if you need to look for an user on Syncope always prefer rest apis
[1] to db client ;)
Thanks,
Hugo Cerdeira.
--
Sent from: http://syncope-user.1051894.n5.nabble.com/
Best regards,
Andrea
[1] https://syncope.apache.org/docs/reference-guide.html#rest
--
Dott. Andrea Patricelli
Tel. +39 3204524292
Developer @ Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173
http://www.tirasa.net
Apache Syncope PMC Member