I was working around IdentityServer 4 (1.0.0-beta5).
By default, the endpoint for authentication is: '/connect/token'.
How can I change the default endpoints in IdentityServer, for instance to: '/api/login'?
Thanks
IdentityServer4 support will last until the end of life of . NET Core 3.1 that means till November 2022.
Get the client's access token back. With the help of the client Id and secret, the client authenticates with the token endpoint. Resource owner password grant type : You can use the Resource Owner Password to request tokens on behalf of a user to send the user name and password to the token endpoint.
Endpoint Discovery is the process where a specific URL (the "discovery endpoint") is accessed, which returns a directory of endpoints for using the system. Other code can interrogate that directory to find the specific URLs for accessing various resources.
Now the version of IdentityServer being included in Microsoft's popular templates requires that users earning more than $1m per year pay license fees as low as $1,500 per year.
Once you setup Identity Server 4 at Startup - you could use this "hack" and update the endpoint paths:
var builder = services.AddIdentityServer()
.AddDeveloperSigningCredential()
.AddInMemoryApiResources(Config.GetApiResources())
.AddInMemoryClients(Config.GetClients());
builder.Services
.Where(service => service.ServiceType == typeof(Endpoint))
.Select(item => (Endpoint)item.ImplementationInstance)
.ToList()
.ForEach(item => item.Path = item.Path.Value.Replace("/connect", ""));
Basically - Endpoint's such as TokenEndpoint, AuthorizeEndpoint classes are internally registered once you call AddIdentityServer - when it calls AddDefaultEndPoints method. Now Endpoint's are iterated upon receiving each request to match the requested Url; so changing the path would immediately take effect.
Please note that in the above example - I have removed all the "/connect" values from any of the paths that were prefixed with it.
Right now you cannot change the endpoint URLs of the protocol endpoints. If you think this is needed, please open an issue on github.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With