p2-inc / keycloak-orgs

Single realm, multi-tenancy for SaaS apps
https://phasetwo.io
Other
389 stars 66 forks source link

Location header is wrong on creation #19

Closed xgp closed 1 year ago

xgp commented 1 year ago

This:

    URI location =
        AdminRoot.realmsUrl(session.getContext().getUri())
            .path(realm.getName())
            .path("orgs")
            .path(o.getId())
            .build();

is creating

http://localhost:65218/auth/admin/realms/master/orgs/bc7fd2ef-8ac8-4d7d-9200-ed0faf8c7b2a

shouldn't have the /admin part in there.

xgp commented 1 year ago

The problem is using AdminRoot.realmsUrl. Looks like a standard in the Keycloak code. E.g.:

 return Response.created(session.getContext().getUri().getAbsolutePathBuilder().path(user.getId()).build()).build();