Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaks with the latest version of Identity Server 4 #1

Open
improwise opened this issue Sep 29, 2020 · 2 comments
Open

Breaks with the latest version of Identity Server 4 #1

improwise opened this issue Sep 29, 2020 · 2 comments

Comments

@improwise
Copy link

improwise commented Sep 29, 2020

Hi,

Great demo but it breaks once you update Identity Server to latest version, ApiResource more specifically.

Thanks.

Migration steps to v4
As described above, starting with v4, scopes have their own definition and can optionally be referenced by resources. Before v4, scopes where always contained within a resource.

To migrate to v4 you need to split up scope and resource registration, typically by first registering all your scopes (e.g. using the AddInMemoryApiScopes method), and then register the API resources (if any) afterwards. The API resources will then reference the prior registered scopes by name.
@improwise
Copy link
Author

This probably means that some updates are necessary for the article as well as some of the definitions are not correct any more

https://vmsdurano.com/apiboilerplate-and-identityserver4-access-control-for-apis/

@improwise
Copy link
Author

improwise commented Sep 29, 2020

So, basically, remove Scope definition from ApiResources, then create a new class with something like this (a bit rough but still)

    internal static class ScopeManager
    {
        public static IEnumerable<ApiScope> Scopes =>
            new List<ApiScope>
            {
                new ApiScope(name: "app.api.whatever.read",   displayName: "Read your data."),
                new ApiScope(name: "app.api.whatever.write",  displayName: "Write your data."),
                new ApiScope(name: "app.api.whatever.delete", displayName: "Delete your data.")
            };
    }

and add in Startup:

.AddInMemoryApiScopes(Data.ScopeManager.Scopes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant