Microsoft Graph Authentication (#6051)

* add microsoft graph auth

* change mail to id

* add graph user id and email

* add microsoft graph auth test case

* remove validating auth data using mail

* add test case to AuthenticationAdapters

* fix indentation

* fix httpsRequest and fakeClaim not found

* add newline eof last

* fix test in auth adapter

* fix unhandled promise rejection
This commit is contained in:
Alann Maulana
2019-09-27 01:23:18 +07:00
committed by Diamond Lewis
parent dd08786a53
commit 38e0ff9d76
4 changed files with 76 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
const microsoft = require('../lib/Adapters/Auth/microsoft');
describe('Microsoft Auth', () => {
it('should fail to validate Microsoft Graph auth with bad token', done => {
const authData = {
id: 'fake-id',
mail: 'fake@mail.com',
access_token: 'very.long.bad.token',
};
microsoft.validateAuthData(authData).then(done.fail, err => {
expect(err.code).toBe(101);
expect(err.message).toBe(
'Microsoft Graph auth is invalid for this user.'
);
done();
});
});
});