[keycloak-user] Configuring SMTP settings via rest API

kapil joshi kapilkumarjoshi001 at gmail.com
Thu Feb 21 06:22:31 EST 2019


Hi Tony,

Thanks for this idea, I'm able to save the SMTP alone via this API. But I
realised that i should have user with client role of realm-management with
manage-realms priviledge.
I was hoping kind of avoid assigning this role. Please let me know if you
have any solutions to this situation.

Thanks again for your help
Kapil

On Wed, Feb 20, 2019 at 12:18 AM Tony Harris <Tony.Harris at oneadvanced.com>
wrote:

> There is a GET method GET /admin/realms/{realm} that returns the
> RealmRepresentation as a JSON object and a PUT method that takes the
> RealmRepresentation and should allow you to do update the SMTP settings.
>
> See
> https://www.keycloak.org/docs-api/3.0/rest-api/index.html#_realms_admin_resource
>
> -----Original Message-----
> From: keycloak-user-bounces at lists.jboss.org [mailto:
> keycloak-user-bounces at lists.jboss.org] On Behalf Of kapil joshi
> Sent: 19 February 2019 14:59
> To: Felix Knecht <Felix.Knecht at hrm-systems.ch>;
> keycloak-user at lists.jboss.org
> Subject: Re: [keycloak-user] Configuring SMTP settings via rest API
>
> Hi all,
>
> Just rechecking, of there is a solution to this issue, please let us know.
>
> Kapil
>
> On Fri, 15 Feb 2019, 17:51 kapil joshi, <kapilkumarjoshi001 at gmail.com>
> wrote:
>
> > Thanks Felix, but i was looking more from rest api end, as im using
> > javascript adapter of keycloak.
> >
> > Can someone point to the rest API  way of saving SMTP settings.
> >
> > Thanks
> > Kapil
> >
> >
> > On Fri, Feb 15, 2019 at 5:50 PM kapil joshi
> > <kapilkumarjoshi001 at gmail.com>
> > wrote:
> >
> >> Thanks Felix, but i was looking more from rest api end, as im using
> >> javascript adapter of keycloak.
> >>
> >> Can someone point to the rest API  way of saving SMTP settings.
> >>
> >> Thanks & regards
> >> Kapil
> >>
> >> On Fri, Feb 15, 2019 at 3:42 PM Felix Knecht
> >> <Felix.Knecht at hrm-systems.ch>
> >> wrote:
> >>
> >>> Hi Kapil
> >>>
> >>> I use something like
> >>>
> >>>             Keycloak keycloak = KeycloakBuilder.builder()
> >>>                     .serverUrl(serverUrl)
> >>>                     .realm(realm)
> >>>                     .clientId(clientId)
> >>>                     .clientSecret(clientSecret)
> >>>                     .username(username)
> >>>                     .password(password)
> >>>                     .build();
> >>>             RealmRepresentation smtpRealm = new RealmRepresentation();
> >>>             Map<String, String> smtpServer = new HashMap<>();
> >>>             smtpServer.put("host", myHost);
> >>>             smtpServer.put("port", myPort);
> >>>             smtpServer.put("from", myFrom);
> >>>             smtpServer.put("auth", "true");
> >>>             smtpServer.put("user", mySmtpUser);
> >>>             smtpServer.put("password", mySmtpPassword);
> >>>             smtpRealm.setSmtpServer(smtpServer);
> >>>             keycloak.realms().realm(myRealm).update(smtpRealm);
> >>>
> >>> Regards
> >>> Felix
> >>>
> >>>
> >>> > -----Ursprüngliche Nachricht-----
> >>> > Von: keycloak-user-bounces at lists.jboss.org <keycloak-user-
> >>> > bounces at lists.jboss.org> Im Auftrag von kapil joshi
> >>> > Gesendet: Donnerstag, 14. Februar 2019 19:49
> >>> > An: keycloak-user at lists.jboss.org
> >>> > Betreff: [keycloak-user] Configuring SMTP settings via rest API
> >>> >
> >>> > Hi all,
> >>> >
> >>> > I wanted one small example of configuring SMTP settings via rest API.
> >>> >
> >>> > We are planning to create one similar UI as like keycloak. But use
> >>> rest API to set it.
> >>> >
> >>> > Also how to test the saved settings, like is it saved or not
> >>> >
> >>> > Thanks
> >>> > Kapil
> >>> > _______________________________________________
> >>> > keycloak-user mailing list
> >>> > keycloak-user at lists.jboss.org
> >>> > https://lists.jboss.org/mailman/listinfo/keycloak-user
> >>>
> >>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
> ________________________________
>
> Please consider the environment: Think before you print!
>
>
> This message has been scanned for malware by Websense. www.websense.com
>


More information about the keycloak-user mailing list