[keycloak-user] Poor/buggy TypeScript adapter implementation

Stan Silvert ssilvert at redhat.com
Fri Apr 6 08:30:42 EDT 2018


I totally agree that we need to coalesce around one project for this.  
I've intended that keyclosk-schematic would become that project and that 
it would be moved in under the official Keycloak umbrella.  I still 
think that is what should happen.  And we should also take the best 
ideas (and even code) from these other projects as we go.

I don't agree with the idea of having a separate TypeScript adapter.  As 
we all know, TypeScript is just transpiled to javascript.  So it makes 
more sense to enhance the javascript adapter than to have two adapters 
that go in different directions.  That way, core functionality always 
has just one code base.

The TypeScript/Angular project should focus on making that javascript 
adapter easier to use and better integrated into an Angular 
environment.  So the TypeScript/Angular project becomes all about type 
defs, wrappers, and services built on top of the javascript adapter.

Stan

On 4/6/2018 5:16 AM, Marcel Német wrote:
> At the moment, there are multiple projects on GitHub which try to bring
> advanced Keycloak functionality into angular 2+ projects.
>
> There are projects which are based on the official keycloak javascript
> adapter (these projects copy files from or import the official javascript
> adapter) for example :
> https://github.com/ssilvert/keycloak-schematic (works with angular 2+)
> and
> https://github.com/mauriciovigolo/keycloak-angular (works with angular 4.3+
> and provides the implementation for the great HttpInterceptor (angular
> 4.3+) in order to add bearer tokens to HTTP requests)
>
> Both of these projects are missing the implementation of Authorization
> flow, and it is not easy to implement this when one tries to use the
> official Keycloak javascript adapter with TypeScript. For example,
> KeycloakAuthorization returns undefined when constructed and does not
> return an observable after executing async HTTP request to
> /.well-known/uma-configuration .
>
> There is another project:
> https://github.com/ebondu/angular2-keycloak
>
> which is not using the official keycloak javascript adapter. Instead, the
> authors have rewritten the code from official JS adapter into TypeScript.
> It seems to address issues which I was not able to solve with the official
> javascript adapter. For example, it notifies the initialization of
> Authorization object (see
> https://github.com/ebondu/angular2-keycloak/blob/b8dd423fefc98305ac2f2f9efd1178020a8a2966/src/services/keycloak.auth.service.ts#L154
> ).
>
> But this project is not updated as often as the official javascript
> adapter. For example, it does not support uma2 which is coming with 4.0.0.
>
> I believe it would be good to invest some effort into making the basic
> keycloak javascript adapter working well with angular/typescript. There is
> clearly interest in building good libraries, but these have to be based on
> a working, official and updated basic adapter. One option would be to pull
> the code from https://github.com/ebondu/angular2-keycloak. Or endorse some
> working implementation for TypeScript.
>
> issue: https://issues.jboss.org/browse/KEYCLOAK-7021
>
> Best regards
>



More information about the keycloak-user mailing list