[keycloak-user] Script Based Authenticator - Web Service Call

Frank Herrmann frank.herrmann at modernizingmedicine.com
Thu Nov 7 12:58:41 EST 2019


Thank you so much. SimpleHttp is exactly what I was looking for.

On Thu, Nov 7, 2019 at 12:47 PM cedric at couralet.eu <cedric at couralet.eu>
wrote:

> Hello,
>
> Le Jeudi, Novembre 07, 2019 15:16 CET, Frank Herrmann <
> frank.herrmann at modernizingmedicine.com> a écrit:
>
> > Hello all,
> >
> > I'm attempting to use a script based authenticator to fire as part of the
> > post login flow of an identity provider. I need to make a web service
> call
> > from this script. Is this even possible? I've tried using XMLHttpRequest,
> > but as this is not executing inside a browser, it does not work. Is
> there a
> > way to get access to RestEasy on Wildfly and use REST.request()?
> >
>
> For a similar need, we used the SimpleHttp class from keycloak like this :
>
> SimpleHttp = Java.type("org.keycloak.broker.provider.util.SimpleHttp");
>
> function authenticate(context) {
>     var result= SimpleHttp.doGet('http://yoururl.test').asString();
>     //do something with result
>     context.success();
> }
>
> SimpleHttp methods can be found here :
> https://github.com/keycloak/keycloak/blob/master/server-spi-private/src/main/java/org/keycloak/broker/provider/util/SimpleHttp.java
>
> There may be a way to get a complete RestEasy client but SimpleHttp was
> enough for us.
>
> Cédric
>
> > Basically, has anyone had to do anything similar, and what did you do to
> > accomplish this? Or, if this isn't possible in the limitations of a
> script
> > based authenticator, should I just write a small authenticator in Java to
> > handle this.
> >
> > Thanks for the help.
> >
> > -Frank
>
>

-- 
FRANK HERRMANN
ASSOCIATE SOFTWARE ARCHITECT

T: 561-880-2998 x1563

E: frank.herrmann at modmed.com



[image: [ Modernizing Medicine ]] <http://www.modmed.com/>
[image: [ Facebook ]] <http://www.facebook.com/modernizingmedicine> [image:
[ LinkedIn ]] <http://www.linkedin.com/company/modernizing-medicine/> [image:
[ YouTube ]] <http://www.youtube.com/user/modernizingmedicine> [image: [
Twitter ]] <https://twitter.com/modmed> [image: [ Blog ]]
<http://www.modmed.com/BlogBeyondEMR> [image: [ Instagram ]]
<http://instagram.com/modernizing_medicine>

[image: [ MOMENTUM 2019 ]] <https://momentum.modmed.com/>

-- 
*CONFIDENTIALITY NOTICE:* This e-mail message may contain material 
protected by the Health Insurance Portability and Accountability Act of 
1996 and its implementing regulations and other state and federal laws and 
legal privileges. This message is only for the personal and confidential 
use of the individuals or organization to whom the message is addressed. If 
you are an unintended recipient, you have received this message in error, 
and any reading, distributing, copying or disclosure is unauthorized and 
strictly prohibited.  All recipients are hereby notified that any 
unauthorized receipt does not waive any confidentiality obligations or 
privileges. If you have received this message in error, please notify the 
sender immediately at the above email address and confirm that you have 
deleted or destroyed the message.


More information about the keycloak-user mailing list