Skip to content

Commit 823a05a

Browse files
committed
Update to Angular2 RC6
1 parent bdef72a commit 823a05a

File tree

6 files changed

+79
-53
lines changed

6 files changed

+79
-53
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Change Log
22

33
## v0.1.4
4-
**Bugfixes:**
4+
**Features:**
55
- Added packaged library to npm package for systemjs support (fixes [#6](https://github.com/neroniaky/angular2-token/issues/6))
6+
- Update Dependencies to Angular2 RC6
67

78
## v0.1.3
89
**Bugfixes:**

config/spec-bundle.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@ require('ts-helpers');
88

99
require('zone.js/dist/zone');
1010
require('zone.js/dist/long-stack-trace-zone');
11-
require('zone.js/dist/jasmine-patch');
11+
require('zone.js/dist/proxy'); // since zone.js 0.6.15
12+
require('zone.js/dist/sync-test');
13+
require('zone.js/dist/jasmine-patch'); // put here since zone.js 0.6.14
1214
require('zone.js/dist/async-test');
1315
require('zone.js/dist/fake-async-test');
14-
require('zone.js/dist/sync-test');
1516

1617
// RxJS
1718
require('rxjs/Rx');
1819

1920
var testing = require('@angular/core/testing');
2021
var browser = require('@angular/platform-browser-dynamic/testing');
2122

22-
testing.setBaseTestProviders(
23-
browser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
24-
browser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
23+
testing.TestBed.initTestEnvironment(
24+
browser.BrowserDynamicTestingModule,
25+
browser.platformBrowserDynamicTesting()
2526
);
2627

2728
var testContext = require.context('../src', true, /\.spec\.ts/);

package.json

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,51 +14,53 @@
1414
"token authentication"
1515
],
1616
"peerDependencies": {
17-
"@angular/core": "2.0.0-rc.5",
18-
"@angular/http": "2.0.0-rc.5",
19-
"@angular/common": "2.0.0-rc.5",
20-
"@angular/router": "^3.0.0-rc.1",
21-
"rxjs": "5.0.0-beta.6"
17+
"@angular/core": "2.0.0-rc.6",
18+
"@angular/http": "2.0.0-rc.6",
19+
"@angular/common": "2.0.0-rc.6",
20+
"@angular/router": "^3.0.0-rc.2",
21+
"rxjs": "5.0.0-beta.11"
2222
},
2323
"devDependencies": {
24-
"@angular/common": "2.0.0-rc.5",
25-
"@angular/compiler": "2.0.0-rc.5",
26-
"@angular/core": "2.0.0-rc.5",
27-
"@angular/http": "2.0.0-rc.5",
28-
"@angular/router": "^3.0.0-rc.1",
29-
"@angular/platform-browser": "2.0.0-rc.5",
30-
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
31-
"@angular/platform-server": "2.0.0-rc.5",
24+
25+
"@angular/core": "2.0.0-rc.6",
26+
"@angular/http": "2.0.0-rc.6",
27+
"@angular/common": "2.0.0-rc.6",
28+
"@angular/router": "^3.0.0-rc.2",
29+
"rxjs": "5.0.0-beta.11",
30+
31+
"@angular/compiler": "2.0.0-rc.6",
32+
"@angular/platform-browser": "2.0.0-rc.6",
33+
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
34+
"@angular/platform-server": "2.0.0-rc.6",
3235
"ie-shim": "^0.1.0",
33-
"rxjs": "5.0.0-beta.6",
34-
"typescript": "^2.0.0-beta",
35-
"zone.js": "0.6.13",
36+
"typescript": "^2.0.0",
37+
"zone.js": "0.6.17",
3638

3739
"@types/core-js": "^0.9.28",
3840
"@types/hammerjs": "^2.0.28",
3941
"@types/jasmine": "^2.2.29",
40-
"@types/node": "^4.0.29",
42+
"@types/node": "^6.0.38",
4143
"@types/source-map": "^0.1.26",
4244
"@types/webpack": "^1.12.29",
4345
"@types/protractor": "^1.5.16",
4446

45-
"awesome-typescript-loader": "1.1.1",
47+
"awesome-typescript-loader": "^2.2.1",
4648
"source-map-loader": "^0.1.5",
4749
"istanbul-instrumenter-loader": "^0.2.0",
4850

4951
"protractor": "^3.2.2",
5052

51-
"core-js": "^2.4.0",
53+
"core-js": "^2.4.1",
5254
"http-server": "^0.9.0",
5355

5456
"jasmine-core": "^2.4.1",
5557
"karma": "^0.13.22",
56-
"karma-chrome-launcher": "^1.0.1",
58+
"karma-chrome-launcher": "^2.0.0",
5759
"karma-coverage": "^1.0.0",
5860
"karma-jasmine": "^1.0.2",
5961
"karma-mocha-reporter": "^2.0.0",
6062
"karma-sourcemap-loader": "^0.3.7",
61-
"karma-webpack": "1.7.0",
63+
"karma-webpack": "1.8.0",
6264
"remap-istanbul": "^0.6.3",
6365

6466
"ts-helpers": "1.1.1",

src/angular2-token.model.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,26 @@ export interface AuthData {
1111
uid: string;
1212
}
1313

14+
export interface OAuthPaths {
15+
github?: string;
16+
}
17+
1418
export interface Angular2TokenOptions {
15-
apiPath?: string;
16-
signInPath?: string;
17-
signOutPath?: string;
18-
validateTokenPath?: string;
19+
apiPath?: string;
20+
signInPath?: string;
21+
signOutPath?: string;
22+
validateTokenPath?: string;
1923

20-
deleteAccountPath?: string;
21-
registerAccountPath?: string;
22-
registerAccountCallback?: string;
24+
deleteAccountPath?: string;
25+
registerAccountPath?: string;
26+
registerAccountCallback?: string;
2327

24-
updatePasswordPath?: string;
28+
updatePasswordPath?: string;
2529

26-
resetPasswordPath?: string;
27-
resetPasswordCallback?: string;
30+
resetPasswordPath?: string;
31+
resetPasswordCallback?: string;
2832

29-
userTypes?: UserType[];
30-
}
33+
userTypes?: UserType[];
34+
35+
oAuthPaths?: OAuthPaths;
36+
}

src/angular2-token.service.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ export class Angular2TokenService {
5959
resetPasswordPath: 'auth/password',
6060
resetPasswordCallback: window.location.href,
6161

62-
userTypes: null
62+
userTypes: null,
63+
64+
oAuthPaths: {
65+
github: 'auth/github'
66+
}
6367
};
6468

6569
this._options = Object.assign(defaultOptions, options);
@@ -110,6 +114,17 @@ export class Angular2TokenService {
110114
return observ;
111115
}
112116

117+
signInOAuth(oAuthType: string) {
118+
119+
let oAuthPath: string;
120+
121+
if (oAuthType == 'github') {
122+
oAuthPath = this._options.oAuthPaths.github
123+
}
124+
125+
window.open(this._constructUserPath() + oAuthPath);
126+
}
127+
113128
// Sign out request and delete storage
114129
signOut(): Observable<Response> {
115130
let observ = this.delete(this._constructUserPath() + this._options.signOutPath);

src/angular2-token.spec.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Http, BaseRequestOptions, Response, ResponseOptions, Headers, RequestMethod } from '@angular/http';
22
import { MockBackend } from '@angular/http/testing';
3-
import { provide } from '@angular/core';
4-
import { inject, addProviders } from '@angular/core/testing';
3+
import { inject, TestBed } from '@angular/core/testing';
54
import { ActivatedRoute, RouterOutletMap, RouterState } from '@angular/router';
65

76
import { Angular2TokenService } from './';
@@ -43,17 +42,19 @@ describe('Angular2TokenService', () => {
4342

4443
beforeEach(() => {
4544
// Inject HTTP and Angular2TokenService
46-
addProviders([
47-
BaseRequestOptions,
48-
MockBackend,
49-
{ provide: ActivatedRoute, useClass: Mock },
50-
{
51-
provide: Http,
52-
useFactory: (backend, defaultOptions) => { return new Http(backend, defaultOptions) },
53-
deps: [MockBackend, BaseRequestOptions]
54-
},
55-
Angular2TokenService
56-
]);
45+
TestBed.configureTestingModule({
46+
providers: [
47+
BaseRequestOptions,
48+
MockBackend,
49+
{ provide: ActivatedRoute, useClass: Mock },
50+
{
51+
provide: Http,
52+
useFactory: (backend, defaultOptions) => { return new Http(backend, defaultOptions) },
53+
deps: [MockBackend, BaseRequestOptions]
54+
},
55+
Angular2TokenService
56+
]
57+
});
5758

5859
// Fake Local Storage
5960
var store = {};

0 commit comments

Comments
 (0)