abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.93k stars 3.44k forks source link

move the oauth out of @abp/ng.core #10019

Closed snowchenlei closed 1 year ago

snowchenlei commented 3 years ago

Abp uses the oauth by default to login. However, in some scenarios, we do not use oauth, we use jwt instead. But when environment.oAuthConfig does not exist, it will get error Can you move the oauth related to a separate package?

davidzwa commented 3 years ago

Yes this is quite easy to do.

One of the authors helped me to this replacement provider. Put this in your app module providers array:

        {
            provide: OAuthService,
            useValue: {
                hasValidAccessToken: () => true, // return token status
                configure: () => {
                },
                loadDiscoveryDocument: () => Promise.resolve(),
                events: of(),
                tryLogin: () => {
                },
                setupAutomaticSilentRefresh: () => {
                },
                getAccessToken: () => '' // return access token
            }
        },

I can tell you this works as this has been running in production like this.

snowchenlei commented 3 years ago

Thank you very much for your answer but now i use ng-alain This combination became difficult after 4.4

davidzwa commented 3 years ago

I do agree with you that oAuth is quite hard to remove from the angular setup. But then I must also add that my setup (and yours) deviate quite a lot from the path that Abp has set out as default.

Hopefully the team and us can come to a good mid-way in this triage!

mahmut-gundogdu commented 1 year ago

we have removed authentication packages from the core. If you an ABP user want to implement your own authentication flow, the user can do it much easier. I also documented which function or interface should be overridden.

here the docs. https://github.com/abpframework/abp/pull/15261 here the PR. That feature released with v7.0.0-rc6. https://github.com/abpframework/abp/pull/15201