Friday, 1 February 2019

Windows authentication with Django and Angular?

I am trying to implement the single sign-on using Angular, Django, IIS server.

In IIS windows authentication is enabled.

Angular intercepter code :

intercept(req: HttpRequest<any>, next: HttpHandler):Observable<HttpEvent<any>> {   
 console.log("in intercept")   
 req = req.clone({  
 withCredentials: true });    
return next.handle(req);  }

Django settings.py:

MIDDLEWARE = [    
'django.middleware.security.SecurityMiddleware',    'django.contrib.sessions.middleware.SessionMiddleware',    'corsheaders.middleware.CorsMiddleware',    'django.middleware.common.CommonMiddleware',    'django.middleware.csrf.CsrfViewMiddleware',    'django.contrib.auth.middleware.AuthenticationMiddleware',    'django.contrib.auth.middleware.RemoteUserMiddleware',    'django.contrib.messages.middleware.MessageMiddleware',    'django.middleware.clickjacking.XFrameOptionsMiddleware',]

AUTHENTICATION_BACKENDS = (    'django.contrib.auth.backends.RemoteUserBackend',)

CORS_ORIGIN_ALLOW_ALL = True

ALLOWED_HOSTS = ["*"]

Getting error: (IP-address) has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.



from Windows authentication with Django and Angular?

No comments:

Post a Comment