ronzeidman / ng2-ui-auth

an angular2 repository for authentication based on angular1's satellizer
MIT License
206 stars 64 forks source link

useClass config removed in 8-beta.2 #121

Closed timbell closed 7 years ago

timbell commented 7 years ago

The useClass / CustomConfig support has been removed in beta.2. I was using this to provide the config from a class that injected my own app config service.

Would you consider reinstating this functionality?

ronzeidman commented 7 years ago

You can use a plain object with the same fields instead of a class now. AOT support is now working in Beta.3

timbell commented 7 years ago

My app configuration (including auth) is stored on a server, on a per-app basis. I retrieve this at start-up using a service. I then provide the config to ng2-ui-auth via my service by injecting it into a custom CustomConfig class.

@Injectable()
export class AuthConfig extends CustomConfig {
    constructor(private appConfigService: AppConfigService) {
        super();
        this.providers = appConfigService.appConfig.authProviders;
    }
}
...
Ng2UiAuthModule.forRoot(AuthConfig)

I don't see how I can achieve the equivalent with the the recent changes.

ronzeidman commented 7 years ago

Interesting use case. I'll look into it.

ronzeidman commented 7 years ago

try beta 4 provide your own AuthConfig using:

...
{ provide: CONFIG_OPTIONS, useClass: AuthConfig, deps: [AppConfigService] },
Ng2UiAuthModule.forRootWithoutOptions(),
...
timbell commented 7 years ago

Thanks, yes that works. (I had to work around the interceptor injecting my AppConfigService via ConfigService/CONFIG_OPTIONS by forgoing the use of HttpClient in AppConfigService.)