mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
convert to identityserver auth
This commit is contained in:
@@ -15,10 +15,29 @@ var FolderRequest = function (folder) {
|
||||
var TokenRequest = function (email, masterPasswordHash, device) {
|
||||
this.email = email;
|
||||
this.masterPasswordHash = masterPasswordHash;
|
||||
this.device = null;
|
||||
if (device) {
|
||||
this.device = new DeviceRequest(device);
|
||||
}
|
||||
this.device = null;
|
||||
|
||||
this.toIdentityToken = function () {
|
||||
var obj = {
|
||||
grant_type: 'password',
|
||||
username: this.email,
|
||||
password: this.masterPasswordHash,
|
||||
scope: 'api offline_access',
|
||||
client_id: 'browser'
|
||||
};
|
||||
|
||||
if (this.device) {
|
||||
obj.deviceType = this.device.type;
|
||||
obj.deviceIdentifier = this.device.identifier;
|
||||
obj.deviceName = this.device.name;
|
||||
obj.devicePushToken = this.device.pushToken;
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
};
|
||||
|
||||
var RegisterRequest = function (email, masterPasswordHash, masterPasswordHint) {
|
||||
|
||||
@@ -46,6 +46,15 @@ var TokenResponse = function (response) {
|
||||
}
|
||||
};
|
||||
|
||||
var IdentityTokenResponse = function (response) {
|
||||
this.accessToken = response.access_token;
|
||||
this.expiresIn = response.expires_in;
|
||||
this.refreshToken = response.refresh_token;
|
||||
this.tokenType = response.token_type;
|
||||
|
||||
// TODO: extras
|
||||
};
|
||||
|
||||
var ListResponse = function (data) {
|
||||
this.data = data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user