[keycloak-user] Java Keycloak REST API Wrapper
Rodrigo Sasaki
rodrigopsasaki at gmail.com
Thu Jul 17 17:36:05 EDT 2014
That's perfect :) thanks for the help
I'll get started on it as soon as I can
On Jul 17, 2014 5:55 PM, "Bill Burke" <bburke at redhat.com> wrote:
> @Path("/admin
> public interface Admin {
> @Path("realms/{realm}")
> Realm realm(@PathParameter("realm") realmName);
> }
>
> public interface Realm {
> @GET
> @Produces("application/json")
> RealmRepresentation get();
>
> @DELETE
> void delete();
>
> @PUT
> @Consumes("application/json")
> void update(RealmRepresentation rep);
>
> @Path("users")
> Users users();
> }
>
> public interface Users {
> ...
> }
>
> FOllow me?
>
> Then its just
>
> ResteasyClient client = new ResteasyClientBuilder().build();
> ResteasyWebTarget target = client.target("http://localhost:8080/auth");
>
> String token = ... get a token ...
>
> target.register(new BearerTokenFilter(token)); // you'd have to implement
> this
>
> Admin admin = target.proxy(Admin.class);
>
> admin.realm("master")
>
> That's about as much help I can give you right now.
>
>
>
>
> On 7/17/2014 11:18 AM, Rodrigo Sasaki wrote:
>
>> OK, will do.
>>
>> Is there a way for me to do it like it is there? I'll explain a little
>> better
>>
>> the class *AdminRoot* has the path set to "/admin", and it has a method
>> getRealmsAdmin, with "realms" on the path, and on the
>> *RealmsAdminResource* there's the getRealmAdmin mapped to "{realm}",
>> making the full path for it "/admin/realms/{realm}", even though each
>> one is in a different class.
>>
>> Is there a way for me to do it the same way, I don't know how the Proxy
>> framework would understand that, maybe I would have to set the full path
>>
>>
>> On Thu, Jul 17, 2014 at 12:11 PM, Stian Thorgersen <stian at redhat.com
>> <mailto:stian at redhat.com>> wrote:
>>
>> Rodrigo: just create your own interfaces. If you can try to keep
>> them as consistent with jax-rs classes in services as you can that
>> would be great.
>>
>> ----- Original Message -----
>> > From: "Stian Thorgersen" <stian at redhat.com <mailto:
>> stian at redhat.com>>
>> > To: "Rodrigo Sasaki" <rodrigopsasaki at gmail.com
>> <mailto:rodrigopsasaki at gmail.com>>, "Bill Burke" <bburke at redhat.com
>> <mailto:bburke at redhat.com>>
>> > Cc: keycloak-user at lists.jboss.org
>> <mailto:keycloak-user at lists.jboss.org>
>> > Sent: Wednesday, 16 July, 2014 2:34:44 PM
>> > Subject: Re: [keycloak-user] Java Keycloak REST API Wrapper
>> >
>> > Bill: does it make sense for us to share interfaces (with jax-rs
>> annotations)
>> > for services and admin-client?
>> >
>> > ----- Original Message -----
>> > > From: "Rodrigo Sasaki" <rodrigopsasaki at gmail.com
>> <mailto:rodrigopsasaki at gmail.com>>
>> > > To: "Stian Thorgersen" <stian at redhat.com <mailto:
>> stian at redhat.com>>
>> > > Cc: "Juraci Paixão Kröhling" <juraci at kroehling.de
>> <mailto:juraci at kroehling.de>>,
>> > > keycloak-user at lists.jboss.org
>> <mailto:keycloak-user at lists.jboss.org>
>> > > Sent: Wednesday, 16 July, 2014 2:31:35 PM
>> > > Subject: Re: [keycloak-user] Java Keycloak REST API Wrapper
>> > >
>> > > I'll get on it for sure.
>> > >
>> > > Just one thing, should I create myself the interfaces for the
>> services? Or
>> > > is there a more integrated way to do that?
>> > >
>> > >
>> > > On Wed, Jul 16, 2014 at 10:27 AM, Stian Thorgersen
>> <stian at redhat.com <mailto:stian at redhat.com>>
>> > > wrote:
>> > >
>> > > > Great work with the admin-client. As I commented on GitHub I
>> added it to
>> > > > 'admin-client' branch, and would like a few changes before
>> merging to
>> > > > master:
>> > > >
>> > > > * Make it use RestEasy client framwork
>> > > > * Tests - I've added a starting point to
>> > > >
>> https://github.com/keycloak/keycloak/blob/admin-client/
>> testsuite/integration/src/test/java/org/keycloak/testsuite/admin/
>> AdminClientTest.java
>> > > > * Better error handling - instead of swallowing exceptions it
>> now throws
>> > > > KeycloakException (RuntimeException), but there's HTTP
>> response codes are
>> > > > not checked (see above test that tries to create two users
>> with the same
>> > > > username)
>> > > >
>> > > > If you're happy to do this work that would be awesome!
>> > > >
>> > > > ----- Original Message -----
>> > > > > From: "Rodrigo Sasaki" <rodrigopsasaki at gmail.com
>> <mailto:rodrigopsasaki at gmail.com>>
>> > > > > To: "Stian Thorgersen" <stian at redhat.com
>> <mailto:stian at redhat.com>>
>> > > > > Cc: "Juraci Paixão Kröhling" <juraci at kroehling.de
>> <mailto:juraci at kroehling.de>>,
>> > > > keycloak-user at lists.jboss.org
>> <mailto:keycloak-user at lists.jboss.org>
>> > > > > Sent: Monday, 14 July, 2014 2:44:48 PM
>> > > > > Subject: Re: [keycloak-user] Java Keycloak REST API Wrapper
>> > > > >
>> > > > > Glad to hear it :)
>> > > > >
>> > > > > I'll be waiting on more replies and ideas to perhaps make
>> it better.
>> > > > > Thanks! :)
>> > > > >
>> > > > >
>> > > > > On Mon, Jul 14, 2014 at 10:43 AM, Stian Thorgersen
>> <stian at redhat.com <mailto:stian at redhat.com>>
>> > > > wrote:
>> > > > >
>> > > > > > Great stuff, I'll have a look at it soon. At first glance
>> it looks
>> > > > really
>> > > > > > good!
>> > > > > >
>> > > > > > Thanks :)
>> > > > > >
>> > > > > > ----- Original Message -----
>> > > > > > > From: "Rodrigo Sasaki" <rodrigopsasaki at gmail.com
>> <mailto:rodrigopsasaki at gmail.com>>
>> > > > > > > To: "Stian Thorgersen" <stian at redhat.com
>> <mailto:stian at redhat.com>>
>> > > > > > > Cc: "Juraci Paixão Kröhling" <juraci at kroehling.de
>> <mailto:juraci at kroehling.de>>,
>> > > > > > keycloak-user at lists.jboss.org
>> <mailto:keycloak-user at lists.jboss.org>
>> > > > > > > Sent: Monday, 14 July, 2014 2:40:17 PM
>> > > > > > > Subject: Re: [keycloak-user] Java Keycloak REST API
>> Wrapper
>> > > > > > >
>> > > > > > > PR submitted :)
>> > > > > > >
>> > > > > > >
>> > > > > > > On Fri, Jul 11, 2014 at 9:56 AM, Stian Thorgersen
>> > > > > > > <stian at redhat.com <mailto:stian at redhat.com>>
>> > > > > > wrote:
>> > > > > > >
>> > > > > > > > Please change package names to
>> 'org.keycloak.admin.client'
>> > > > > > > >
>> > > > > > > > ----- Original Message -----
>> > > > > > > > > From: "Rodrigo Sasaki" <rodrigopsasaki at gmail.com
>> <mailto:rodrigopsasaki at gmail.com>>
>> > > > > > > > > To: "Stian Thorgersen" <stian at redhat.com
>> <mailto:stian at redhat.com>>
>> > > > > > > > > Cc: "Juraci Paixão Kröhling" <juraci at kroehling.de
>> <mailto:juraci at kroehling.de>>,
>> > > > > > > > keycloak-user at lists.jboss.org
>> <mailto:keycloak-user at lists.jboss.org>
>> > > > > > > > > Sent: Friday, 11 July, 2014 1:51:41 PM
>> > > > > > > > > Subject: Re: [keycloak-user] Java Keycloak REST API
>> Wrapper
>> > > > > > > > >
>> > > > > > > > > Just one more question, I created it with my
>> companies' name in
>> > > > the
>> > > > > > > > > package, should I replace it? Or just upload it as
>> is?
>> > > > > > > > >
>> > > > > > > > > It's br.com.icarros.keycloak.api
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > > On Fri, Jul 11, 2014 at 4:13 AM, Stian Thorgersen <
>> > > > stian at redhat.com <mailto:stian at redhat.com>>
>> > > > > > > > wrote:
>> > > > > > > > >
>> > > > > > > > > > You can create a new module for it in:
>> > > > > > > > > >
>> > > > > > > > > > integration/admin-client
>> > > > > > > > > >
>> > > > > > > > > > ----- Original Message -----
>> > > > > > > > > > > From: "Rodrigo Sasaki"
>> <rodrigopsasaki at gmail.com <mailto:rodrigopsasaki at gmail.com>>
>> > > > > > > > > > > To: "Stian Thorgersen" <stian at redhat.com
>> <mailto:stian at redhat.com>>
>> > > > > > > > > > > Cc: "Juraci Paixão Kröhling"
>> <juraci at kroehling.de <mailto:juraci at kroehling.de>>,
>> > > > > > > > > > keycloak-user at lists.jboss.org
>> <mailto:keycloak-user at lists.jboss.org>
>> > > > > > > > > > > Sent: Thursday, 10 July, 2014 8:50:00 PM
>> > > > > > > > > > > Subject: Re: [keycloak-user] Java Keycloak REST
>> API Wrapper
>> > > > > > > > > > >
>> > > > > > > > > > > Stian, how should I send the code that I made
>> to the
>> > > > > > > > > > > Keycloak
>> > > > > > repo?
>> > > > > > > > > > >
>> > > > > > > > > > > Can you tell me what module name to use, and
>> where to
>> > > > > > > > > > > create
>> > > > it?
>> > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > > > On Tue, Jul 8, 2014 at 10:00 AM, Rodrigo Sasaki <
>> > > > > > > > > > rodrigopsasaki at gmail.com
>> <mailto:rodrigopsasaki at gmail.com>>
>> > > > > > > > > > > wrote:
>> > > > > > > > > > >
>> > > > > > > > > > > > I would really like to do that :) All I'm
>> waiting for is
>> > > > an OK
>> > > > > > to
>> > > > > > > > do
>> > > > > > > > > > it,
>> > > > > > > > > > > > because it was built inside the company, so I
>> need
>> > > > approval.
>> > > > > > > > > > > >
>> > > > > > > > > > > > But I really believe it'll get a lot better
>> when it's out
>> > > > > > there,
>> > > > > > > > and
>> > > > > > > > > > you
>> > > > > > > > > > > > can all pitch in
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > > On Tue, Jul 8, 2014 at 9:55 AM, Stian
>> Thorgersen <
>> > > > > > stian at redhat.com <mailto:stian at redhat.com>
>> > > > > > > > >
>> > > > > > > > > > wrote:
>> > > > > > > > > > > >
>> > > > > > > > > > > >> Ideal way to contribute it to Keycloak would
>> be if you
>> > > > fork
>> > > > > > the
>> > > > > > > > > > Keycloak
>> > > > > > > > > > > >> repo, add a module and do a PR ;)
>> > > > > > > > > > > >>
>> > > > > > > > > > > >> ----- Original Message -----
>> > > > > > > > > > > >> > From: "Rodrigo Sasaki"
>> <rodrigopsasaki at gmail.com <mailto:rodrigopsasaki at gmail.com>>
>> > > > > > > > > > > >> > To: "Juraci Paixão Kröhling"
>> <juraci at kroehling.de <mailto:juraci at kroehling.de>>
>> > > > > > > > > > > >> > Cc: keycloak-user at lists.jboss.org
>> <mailto:keycloak-user at lists.jboss.org>
>> > > > > > > > > > > >> > Sent: Tuesday, 8 July, 2014 1:50:14 PM
>> > > > > > > > > > > >> > Subject: Re: [keycloak-user] Java Keycloak
>> REST API
>> > > > Wrapper
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> > Oh yes, I believe it is already very usable.
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> > All I need now is to get my manager to
>> agree to make
>> > > > this
>> > > > > > repo
>> > > > > > > > > > public,
>> > > > > > > > > > > >> > because there is a policy that all repos
>> are private
>> > > > > > > > > > > >> > in
>> > > > this
>> > > > > > > > project
>> > > > > > > > > > > >> we're
>> > > > > > > > > > > >> > working in, but I don't think we'll have
>> problems with
>> > > > > > this. I
>> > > > > > > > > > pitched
>> > > > > > > > > > > >> him
>> > > > > > > > > > > >> > the idea of contributing to Keycloak and
>> he seemed to
>> > > > like
>> > > > > > it
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> > On Tue, Jul 8, 2014 at 9:32 AM, Juraci
>> Paixão Kröhling
>> > > > > > > > > > > >> > <
>> > > > > > > > > > > >> juraci at kroehling.de <mailto:
>> juraci at kroehling.de>
>> > > > > > > > > > > >> > > wrote:
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> > -----BEGIN PGP SIGNED MESSAGE-----
>> > > > > > > > > > > >> > Hash: SHA512
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> > Hello Rodrigo,
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> > Do you have news about this? I'm working
>> on a task
>> > > > > > > > > > > >> > that
>> > > > > > would
>> > > > > > > > > > require
>> > > > > > > > > > > >> > me to do something similar, so, I think it
>> would best
>> > > > if we
>> > > > > > can
>> > > > > > > > > > > >> > collaborate on this API :-)
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> > If/when you have some time, we could have
>> a chat via
>> > > > > > > > > > > >> > IRC
>> > > > > > > > > > (jpkroehling
>> > > > > > > > > > > >> > at #keycloak on freenode).
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> > - - Juca.
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> > On 06/20/2014 10:00 PM, Rodrigo Sasaki
>> wrote:
>> > > > > > > > > > > >> > > I'm working on a Java-based wrapper for
>> the REST
>> > > > > > > > > > > >> > > API,
>> > > > to
>> > > > > > make
>> > > > > > > > it
>> > > > > > > > > > > >> > > look more OO, abstracting the access to
>> servers.
>> > > > > > > > > > > >> > >
>> > > > > > > > > > > >> > > It uses methods such as
>> > > > > > > > > > > >> > >
>> > > > > > > > > > > >> > > User bill = realm.getUser("bburke")
>> > > > > > List<RoleRepresentation>
>> > > > > > > > roles
>> > > > > > > > > > > >> > > =
>> > > > > > > > > > > >> > >
>> bill.getApplicationRoleMappings("customer-portal");
>> > > > > > > > > > > >> > >
>> > > > > > > > > > > >> > > It's still in it's early stages, but if
>> you find it
>> > > > > > > > interesting,
>> > > > > > > > > > > >> > > I'd be happy to create a repo for other
>> Java users
>> > > > > > > > > > > >> > > to
>> > > > use
>> > > > > > it,
>> > > > > > > > and
>> > > > > > > > > > > >> > > adapt it based on suggestions aswell.
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> > -----BEGIN PGP SIGNATURE-----
>> > > > > > > > > > > >> > Version: GnuPG v2
>> > > > > > > > > > > >> > Comment: Using GnuPG with Thunderbird -
>> > > > > > > > http://www.enigmail.net/
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> >
>> > > > > >
>> iQEcBAEBCgAGBQJTu+ThAAoJEDnJtskdmzLM4PcH/jShu9J6nnV92HqSyqyy4y7d
>> > > > > > > > > > > >> >
>> > > > > >
>> snhFqt4G+aqyhdH4iiOUbV36Zb07fPnO5w7s9vcr79YLGjuAWaODIzU1D1yZxbyA
>> > > > > > > > > > > >> >
>> > > > > >
>> X4e3y5ClCSZMefHGSXoCOs7U+cVuCAUivCXBhe+hIb4pM/2krlhaS+ai3I2Ur43Z
>> > > > > > > > > > > >> >
>> > > > > >
>> 5uzPS+pz983y2i1UGkhJBzqv8MVabNPq3vC+LX2bK9vEmd4Qiz0LdC9jwP23DZY9
>> > > > > > > > > > > >> >
>> > > > > >
>> srdtReO5uC0/HjtfzrNP+ErY1WpIEFAuHW5abtL7HHwvdZYNgYUIj6f8w8oGGLMp
>> > > > > > > > > > > >> >
>> > > > > >
>> iaHvbFMPFmuqNisDqbOWf6OtG7E3Nk2anqeUu5qcvCaPyMQA8edvgctc4a2jbJc=
>> > > > > > > > > > > >> > =3O4p
>> > > > > > > > > > > >> > -----END PGP SIGNATURE-----
>> > > > > > > > > > > >> >
>> _______________________________________________
>> > > > > > > > > > > >> > keycloak-user mailing list
>> > > > > > > > > > > >> > keycloak-user at lists.jboss.org
>> <mailto:keycloak-user at lists.jboss.org>
>> > > > > > > > > > > >> >
>> https://lists.jboss.org/mailman/listinfo/keycloak-user
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> > --
>> > > > > > > > > > > >> > Rodrigo Sasaki
>> > > > > > > > > > > >> >
>> > > > > > > > > > > >> >
>> _______________________________________________
>> > > > > > > > > > > >> > keycloak-user mailing list
>> > > > > > > > > > > >> > keycloak-user at lists.jboss.org
>> <mailto:keycloak-user at lists.jboss.org>
>> > > > > > > > > > > >> >
>> https://lists.jboss.org/mailman/listinfo/keycloak-user
>> > > > > > > > > > > >>
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > > --
>> > > > > > > > > > > > Rodrigo Sasaki
>> > > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > > > --
>> > > > > > > > > > > Rodrigo Sasaki
>> > > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > > --
>> > > > > > > > > Rodrigo Sasaki
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > > --
>> > > > > > > Rodrigo Sasaki
>> > > > > > >
>> > > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > > --
>> > > > > Rodrigo Sasaki
>> > > > >
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > Rodrigo Sasaki
>> > >
>> >
>> > _______________________________________________
>> > keycloak-user mailing list
>> > keycloak-user at lists.jboss.org <mailto:keycloak-user at lists.
>> jboss.org>
>> > https://lists.jboss.org/mailman/listinfo/keycloak-user
>>
>>
>>
>>
>> --
>> Rodrigo Sasaki
>>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20140717/17893514/attachment-0001.html
More information about the keycloak-user
mailing list