Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call Breeze Controller with Windows authentication #18

Open
janminarik opened this issue Dec 29, 2017 · 1 comment
Open

Call Breeze Controller with Windows authentication #18

janminarik opened this issue Dec 29, 2017 · 1 comment

Comments

@janminarik
Copy link

janminarik commented Dec 29, 2017

I need call ASP.NET Web API Breeze controller which use Windows authentication from Angular 5 / Breeze app.

I tried some modification for ajaxAdapter

  1. Option
	import { config } from 'breeze-client';

        let ajaxAdapter = <any>config.getAdapterInstance('ajax');
        
        ajaxAdapter.defaultSettings = {
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            },
            withCredentials: true
        };
  1. Option
	import { config } from 'breeze-client';

        let ajaxAdapter = <any>config.getAdapterInstance('ajax');

        ajaxAdapter.defaultSettings = {
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            },
            xhrFields: {
                withCredentials: true
            }
        };

Not work.

Request header doesn’t contains Authorization: NTLM ...

When I call Web API controller (no Breeze) which also require Windows authentication with Angular HttpClient it works.

    const headers = new HttpHeaders({
        'Content-Type': 'application/x-www-form-urlencoded'
    });

    this._httpClient.get(url, { headers, withCredentials: true }));

Request header contains Authorization: NTLM ...

Web Client:

"@angular/core": "^5.0.0",
"typescript": "~2.4.2"
"breeze-bridge-angular": "^4.0.2",
"breeze-client": "^1.6.3",

Any Idea?

Solution:

Use https://github.com/Breeze/breeze.bridge2.angular + angular HttpInterceptor

@marcelgood
Copy link
Collaborator

marcelgood commented Dec 29, 2017

The new Angular HttpClient service allows for interceptors to mutate an outgoing request. This is where you would mutate the request to add things like authentication etc, but make sure you use the new bridge: https://github.com/Breeze/breeze.bridge2.angular

Here'a an article that might help.

https://alligator.io/angular/httpclient-interceptors/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants