I've got a .NET web API that I'm trying to secure and want to allow a client application (angularJs) to make calls to it once it is authorized through the identity server. I want this authorization to be completely separate from user authentication/authorization. I don't want there to be any user interaction.
What have I missed?
Related
I'm creating a centralized authentication system for multiple mobile applications. Its architecture is based on the OpenID Connect flow through the use of OAuth2.0 with IdentityServer4 on ASP.NET Core Identity.
I have researched a lot and in the main implementations with the Authorization Code Flow observed there is always the redirection of the user from the mobile app UI to the server web views, to allow the management of its profile.
This is very uncomfortable, because it significantly compromises the UX. I would like the user to be able to register and authenticate himself directly from the app interface without any redirection that involves opening a browser. Is there a way to do this with only API calls, from the client backend to the centralized authorization server?
You can use the Resource Owner Password Credentials grant type where you can pass the user credentials to the token endpoint and receive an access token. But usage of the ROPC grant type is highly discouraged as you can read in this blog post from Scott Brady, one of the creators of Identity Server.
What I can propose to you is to use Authorization Code flow to login the user and get access token for them, and then creating your custom API endpoints on identity server for user management. More on custom api endpoints here
I am implementing a REST Web API for a service that will be hosted on Windows now (and on Linux in the future).
We are going to support custom credentials + token/refresh token using OAuth 2.0 and OIDC (via Identity Server 4), but we want to support also Windows authentication to allow integration with Active Driectory.
For clients which use windows authentication, is it better to authenticate once and get token/refresh token mechanism (as we do for credentials authentication) or is it better to authenticate each single request?
The latter option might be less performant as it needs to go through the challange every time?
My personal feeling is that if you're having identityserver4 in play already and the fact you've stated you will host the API on Linux in future that you should handle the AD integration in your identity server and have your API only worry about access tokens issued by said service.
I'd then recommend using ADFS (recent versions support OIDC out of the box) for the actual authentication of AD users and have your identity server act as an authentication gateway. If configured correctly you can achieve true SSO (i.e. the user is not required to re-enter their domain credentials) for any user already signed into the domain on their PC.
This just covers authentication however - how will you be doing authorization within this API?
I have a website set up that is responsible for the rendering of information fetched from an API that I have built; both of which are in .NET Core 2.1.
I want the API to handle the authentication using Bearer tokens to ensure that users have the correct permissions to make the calls they're using. I also want to protect my server-server communications too, so that my website can make authenticated calls to the API, without users themselves being authenticated.
I have been following the tutorials for IdentityServer4 and I feel like it's something I should be using to achieve my desired workflow.
However, the tutorials all force the user to redirect to the IdentityServer application to log in. This doesn't feel seamless; I don't want my users being redirected to another domain for authentication; they shouldn't have to leave my site.
Is it possible to send the username and password to my API and have the API authenticate with IdentityServer without the user seeing what is happening behind the scenes?
I am developing a web api service which will be consumed by asp.net mvc web application and mobile apps (android and ios). My database and web api will be hosted on same server. I want to implement authentication for web api (token based). My database has a table for storing user credentials. I will have to use this database to validate the credentials when the user logs in.
Came across a few articles which suggest owin and identity server. I am confused on how to proceed and need some help in understanding a better approach.
you can simply implement the token base authentication
when user is login to the system send the random token code
cash it in the client side
when client side making request to the server send the token with the request header
validate the token and accept request or reject
simple way :)
I've seen a lot of questions regarding OAuth and using it to secure APIs using an external trusted provider.
However, in our organization, we have an existing ASP.NET MVC web application which contains a custom membership provider for authenticating users to use the web application. We are now developing an API (which will be accessed externally) which allows users of the API develop their own clients.
I am looking into different ways to secure the API without passing user credentials. The API will force HTTPS, but the security team does not want user credentials stored on the client systems. I have considered, a token based approach -- but most posts I have read here seem to suggest OAuth. Would the preferable route be some sort of OAuth implementation? And if so, how do I authenticate internal users who are not registered with a trusted provider?
Thanks!
One approach can be to use OAuth token created Microsoft ACS.
If each client user needs to be authenticated, you can use Microsoft ACS to create a trust relationship between you and the client organization (Id Provider) or even other Id providers such as Facebook / Google etc.
Alternatively you can also use service identities for each API client (assuming that each user does not need to authenticated) The clients gets a unique clientId and Secret created by your organization, that you can revoke when needed. The client requests a OAuth2 (JWT) token from ACS and send the token on each API calll. The API validates the token using standard OWIN library for JWT tokens.