2

I have a heavy client side webapp in AngularJS. I'm using a C# controller to do Active Directory authentication, here is this code.

public UserModel Get()
{
        UserModel currentUser = new UserModel();
        currentUser.name = User.Identity.Name;
      //  currentUser.auth = contactFromAD(User.Identity.Name);
        currentUser.auth = true;
        return currentUser;
}

So what its doing is checking what AD account you are logged into, then performing some logic to check if you are authenticated to access the site.

However how can I get this to work outside of localhost. When the code is running server, how can I get User.Identity.Name to return the identity of the person currently using the app.

1 Answer 1

1

I am not sure I understand AngularJS angle. If I had a regular WCF service I would use WindowsIdentity from ServiceSecurityContext.Current.
http://msdn.microsoft.com/en-us/library/system.servicemodel.servicesecuritycontext.aspx

ServiceSecurityContext securityContext = ServiceSecurityContext.Current;

if (securityContext == null)
     throw new Exception("Failed to retrieve Service Security Context");

WindowsIdentity identity = securityContext.WindowsIdentity;
currentUser.name = identity.Name
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.