Connect ActiveDirectory with ASP.NET or PHP - c#

Im looking to create a web application using ASP.NET MVC or PHP (not decided yet!) and I want to use the local ActiveDirectory to register users. Can anyone point out how to do this on PHP or ASP.NET?
Would like answers on any of the technologies
Best regards,
David

For ASP.NET MVC you should ActiveDirectory membershipProvider. Check this
MSDN for more information, how to use and configure it. You have several ways to implement this:
with Windows authentication, which basically tells to the browser to handle the authentication process for you (gathering the username and password from the user)
with Form authentication, where you have to implement your custom form in order the user to be able to provide you with his username and password.
For PHP you integration will be not so out-of-the-box. To be honest I've never tried this, but you should deal with the LDAP object to be able to integrate your Active Directory. You can try this article for more info.

Related

Token Based Authentication MVC 5

I currently have an app built in MVC 5 that uses individual authentication and has Web API access if the user is authenticated within the browser using their username and password.
I am looking to now add in the ability for Token based authentication so that users can GET and POST data to my app from other applications they utilize. I have been searching forums but unable to find a great method that explains the entire process.
Does anyone have any tutorials for this?
Use JWTs. This is a fast and secure way to let users authenticate and act securely with the APIs of your solution
see here

Google - C# WinFormsApp - Auth

I have a question,
Is it possible to use Google user accounts for authentication in WinFormsAPP?
I need to write an application in C# Winforms that reads user-specific data from a database.
Is there an easy way to authenticate using Google?
I might be able to store a list of valid Google users in my database, or maybe I can even define a list of valid application users in Google?
Is there perhaps already a sample project for this case somewhere? I actually can't believe that I am the first developer with such a requirement...
I am grateful for any help or suggestion!
Have a look at:
Integrating "Sign In With Google" Functionality To An Application
Login using Google OAuth 2.0 with C#

Create User authentication in a C# client application

So I wrote quite a few ASP.NET web applications and there I often used the forms authentication. Now I need to do the same but in a client application. What would be the best way to create something like this?
I was searching for it for some time now but I didn't find something that I could implement in my project. I just need to have a login screen and only when it is valid with the user logins I created I should be able to use the complete application.
Can someone please help me?
There are probably several approaches that you could take. If the application is internally distributed you could use a database connection to something like SQL Server where you would have accounts set up to validate against. If the distribution is external you may want to consider setting up a server and using socket connections in your application to make calls to your server(again storing account information in a back end database) to validate users.
I remember using ASP.NET Identity for that purpose. Was very easy and everything is pretty much ready.
ASP.NET Core Identity is a membership system that adds login
functionality to ASP.NET Core apps. Users can create an account with
the login information stored in Identity or they can use an external
login provider
learn.microsoft.com/en-us/aspnet/core/security/authentication/identity

ADFS implementation in existing asp.net mvc application

We have existing mvc application with episerver cms 10. That application performs well. But we now have requirement to implement adfs in existing application.
I checked different links on internet regarding this. I can see that it is straight forward for new application but can't find clear guide on how to implement it with existing application. We have lot of existing users in website using sql server membership and ad authentication. How it will behave with ADFS?
Please provide me correct guide and links for this?
I'm guessing you want to continue to use both SQL users and AD users(?).
First migrate to AspNetIdentity as described here: https://world.episerver.com/blogs/K-Khan-/Dates/2017/10/migrate-from-sql-membership-to-asp-net-identity/.
Then you can add authentication with ADFS as described here: https://hacksbyme.net/2017/05/07/single-sign-on-to-episerver-with-adfs-using-owin/
Finally add the possibility to login with both AD users, and local SQL users: https://hacksbyme.net/2017/05/11/mixed-mode-owin-authentication-for-episerver-editors/
ADFS will only authenticate against users in AD (or with LDAP in ADFS 4.0).
To integrate this into your application, you need a client side protocol stack.
If you are using ADFS 4.0 refer this and this.

Web Api ASP.NET Custom Authentication

I have a Web Api that returns basic info about a company's info. The login information is validated with their DB (this is used for an Desktop App) but with AngularJS im only ask to the API for Username and Password. How i can implement an authentication system (like the default on Visual Studio) on this with their users and passwords? Is possible to use something like Token? Can you help me? Thanks a lot.
[EDIT 1]
By the way, this webapi uses an old foxpro DB to manage the users and password. So if i gone to use the authentication system, i don't know how to use de database context with this type of old DB.
You can look at this step by step article.
Your question is quite broad, but let's try to tackle it. Basically, you need to split it into two:
Communication with FoxproDb from within ASP.NET. There are lots of Q&A here on Stackoverflow on that, for example: FoxPro Database and asp.net.
Consider migrating from FoxproDb to Sql Server if possible.
Authentication is also big topic, but Basic Authentication is an option if you are building Intranet app or app that will be secured with HTTPS. I have looked through tons of articles, and this one is probably the EASIEST and most ot the point Web Api2 Basic Authentication - and if you are going with AngularJs frontend, you'll probably want WebApi2 as backend.
Now, be aware that with Basic Authentication you are sending credentials with every request and thus it's easy to steal username:passwords. If you want to support HTTP you'll probably need to go with some other authentication system.
Other good links:
User Authentication in ASP.NET Web API

Categories

Resources