0

I've created a web application for internal use made of 2 layers:

GUI: SPA in Angular 2

Data: asp. net 5 web API

When I needed to authenticate users in the organization, I added windows authentication on my web api - config. This works fine when a user gets to a page where data is being retrieved, if he's not authorized he'll get a prompt.

Now I also need a way to tell a user that got to a page with no data - just html, that he is not allowed , or render my view to hide some of the links. When I use the web api for unauthorized users - before I even get to process the api server response - I get a browser prompt...

How can I tell the browser/server not to open this dialog, yet return a value saying that this user is authenticated?

user355289
  • 1,100
  • 2
  • 13
  • 23

1 Answers1

0

1) It's the browser that presents the dialog, not the server

2) Your best bet, however, is for the server to redirect. MVC makes this easy; I'm not sure of the best way to do it for your particular scenario.

This might help:

angularjs redirect to login page if not authenticated with exceptions

paulsm4
  • 114,292
  • 17
  • 138
  • 190
  • hi. what i meant is either a way for the server not to return an answer that signals the browser to prompt for credentials - yet contains information whether or not this user is authenticated. Or another solution could be for the client to be able to selectively display or hide the credentials prompt. – user355289 Jun 19 '17 at 13:46