Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions src/auth/progress.auth.azure.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
(function(){

"use strict";

progress.data.AuthenticationProviderAzure = function(uri) {
var bearerToken;

this._initialize(uri, progress.data.Session.AUTH_TYPE_AZURE,
{"_loginURI": progress.data.AuthenticationProvider._homeLoginURIBase});

function make_bearer_token_header() {
return "Bearer " + token;
}

this._reset = function() {
bearerToken = null;
}

this._openLoginRequest = function (xhr, uri) {
var auth;

xhr.open("GET", uri, true); // but see comments below inside the "if userName"
// may have to go with that approach

if (bearerToken) {

// set Authorization header
auth = make_bearer_token_header_header(bearerToken);
xhr.setRequestHeader('Authorization', auth);
}

progress.data.Session._setNoCacheHeaders(xhr);
};

this._processLoginResult = function _azure_processLoginResult(xhr, deferred) {
progress.data.AuthenticationProviderAzure.prototype._processLoginResult.apply(
this,
[xhr, deferred]
);
if (!this._loggedIn) {
bearerToken = null;
}
};

this.login = function (token) {
bearerToken = token;
return this._loginProto();
}

this._openRequestAndAuthorize = function (xhr, verb, uri, async, callback) {
var auth,
errorObject;

xhr.open(verb, uri, async); // but see comments below inside the "if userName"
// may have to go with that approach

if (bearerToken) {

// set Authorization header
auth = make_bearer_token_header(bearerToken);
xhr.setRequestHeader('Authorization', auth);
}

progress.data.Session._setNoCacheHeaders(xhr);

callback(errorObject);
};
};

function AzureProxy() {}
AzureProxy.prototype = progress.data.AuthenticationProvider.prototype;
progress.data.AuthenticationProviderAzure.prototype = new AzureProxy();

progress.data.AuthenticationProviderAzure.prototype.constructor =
progress.data.AuthenticationProviderAzure;
})
3 changes: 3 additions & 0 deletions src/auth/progress.auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ limitations under the License.
case progress.data.Session.AUTH_TYPE_FORM_SSO:
authProv = new progress.data.AuthenticationProviderSSO(initObject.uri);
break;
case progress.data.Session.AUTH_TYPE_AZURE: // NA - 03/2018
authProv = new progress.data.AuthenticationProviderAzure(initObject.uri);
break;
default:
// AuthenticationProvider: The 'init-object' parameter passed to the 'constructor' function
// has an invalid value for the 'authenticationModel' property.
Expand Down
9 changes: 8 additions & 1 deletion src/progress.session.js
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,10 @@ limitations under the License.
this.authenticationModel = this.authenticationModel.toLowerCase();
}

if (this.authenticationModel === progress.data.Session.AUTH_TYPE_AZURE) {
console.log("New type voor Azure");
}

if (this.authenticationModel === progress.data.Session.AUTH_TYPE_SSO) {
// Session: Cannot call login() when authenticationModel is SSO.
// Please use the AuthenticationProvider object instead.
Expand Down Expand Up @@ -3411,7 +3415,9 @@ limitations under the License.
Object.defineProperty(progress.data.Session, 'AUTH_TYPE_FORM_SSO', {
value: "form_sso", enumerable: true
});

Object.defineProperty(progress.data.Session, 'AUTH_TYPE_AZURE', { // NA - 03/2018
value: "azure", enumerable: true
});

Object.defineProperty(progress.data.Session, 'DEVICE_OFFLINE', {
value: "Device is offline", enumerable: true
Expand Down Expand Up @@ -3443,6 +3449,7 @@ limitations under the License.
progress.data.Session.AUTH_TYPE_BASIC = "basic";
progress.data.Session.AUTH_TYPE_FORM = "form";
progress.data.Session.AUTH_TYPE_SSO = "sso";
progress.data.Session.AUTH_TYPE_AZURE = "azure";

/* deliberately not including the "offline reasons" that are defined in the
* 1st part of the conditional. We believe that we can be used only in environments where
Expand Down