├── .editorconfig
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── demo
├── app.component.ts
├── demo.module.ts
├── entry.ts
├── index.html
└── server
│ └── server.js
├── e2e
├── login.spec.ts
└── register.spec.ts
├── karma.conf.js
├── keypair.enc
├── package-lock.json
├── package.json
├── protractor.conf.js
├── src
├── authport
│ ├── authport.component.ts
│ └── index.ts
├── email-verification
│ ├── email-verification.component.ts
│ └── index.ts
├── extensions
│ └── ionic
│ │ └── index.js
├── forgot-password
│ ├── forgot-password.component.ts
│ └── index.ts
├── index.ts
├── login
│ ├── index.ts
│ └── login.component.ts
├── register
│ ├── index.ts
│ └── register.component.ts
├── resend-email-verification
│ ├── index.ts
│ └── resend-email-verification.component.ts
├── reset-password
│ ├── index.ts
│ └── reset-password.component.ts
├── shared
│ ├── account.ts
│ └── index.ts
├── stormpath.module.ts
└── stormpath
│ ├── auth.token.ts
│ ├── event.manager.ts
│ ├── index.ts
│ ├── stormpath.config.ts
│ ├── stormpath.http.ts
│ ├── stormpath.service.ts
│ └── token-store.manager.ts
├── static
├── angular.png
└── stormpath.png
├── test
├── authport
│ └── authport.component.spec.ts
├── entry.ts
├── forgot-password
│ └── forgot-password.component.spec.ts
├── login
│ └── login.component.spec.ts
├── mocks
│ ├── helper.ts
│ └── stormpath.mock.service.ts
├── register
│ └── register.component.spec.ts
└── stormpath
│ ├── stormpath.config.spec.ts
│ ├── stormpath.http.spec.ts
│ └── stormpath.service.spec.ts
├── tsconfig-ngc.json
├── tsconfig.json
├── tslint.json
├── typedoc.json
├── webpack.config.js
├── webpack.config.umd.js
└── yarn.lock
/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 |
12 | [*.md]
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | *.iml
3 | .DS_Store
4 | node_modules
5 | coverage
6 | npm-debug.log
7 | demo/demo.js
8 | demo/demo.js.map
9 | dist/
10 | docs/
11 | *.tgz
12 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - '6'
4 | script:
5 | - npm test
6 | #- npm start &
7 | #- npm run e2e # run protractor tests against local instance
8 | #- npm run e2e:cookies # run protractor tests against local instance with cookie storage
9 | #- npm run e2e:client # run protractor tests against client api
10 | #- npm run e2e:client+cookies # run protractor tests against client api with cookie storage
11 | #- npm run typedoc
12 | cache:
13 | directories:
14 | - node_modules
15 | addons:
16 | apt:
17 | sources:
18 | - google-chrome
19 | packages:
20 | - google-chrome-stable
21 | - google-chrome-beta
22 | before_install:
23 | - if [ $TRAVIS_PULL_REQUEST == 'false' ]; then
24 | test -z "$BUILD_DOCS" || openssl aes-256-cbc -K $encrypted_d98a3227cf72_key -iv $encrypted_d98a3227cf72_iv -in keypair.enc -out ~/.ssh/id_rsa -d;
25 | test -z "$BUILD_DOCS" || chmod 600 ~/.ssh/id_rsa;
26 | fi
27 | - export DISPLAY=:99.0
28 | - sh -e /etc/init.d/xvfb start
29 | after_success:
30 | - test -z "$BUILD_DOCS" || CURRENT_HASH=`git rev-parse HEAD`
31 | - test -z "$BUILD_DOCS" || RELEASE_VERSION=`git tag | xargs -I@ git log --format=format:"%ai
32 | @%n" -1 @ | sort | awk '{print $4}' | tail -n 1`
33 | - test -z "$BUILD_DOCS" || RELEASE_HASH=`git rev-list $RELEASE_VERSION -n 1`
34 | - test -z "$BUILD_DOCS" || if [ "$CURRENT_HASH" = "$RELEASE_HASH" ]; then DEPLOY_DOCS=true;
35 | fi
36 | - test -z "$DEPLOY_DOCS" || git config --global user.email "evangelists@stormpath.com"
37 | - test -z "$DEPLOY_DOCS" || git config --global user.name "stormpath-sdk-angular Auto
38 | Doc Build"
39 | - test -z "$DEPLOY_DOCS" || git clone git@github.com:stormpath/stormpath.github.io.git
40 | - test -z "$DEPLOY_DOCS" || cd stormpath.github.io
41 | - test -z "$DEPLOY_DOCS" || git fetch origin source:source
42 | - test -z "$DEPLOY_DOCS" || git checkout source
43 | - test -z "$DEPLOY_DOCS" || mkdir -p source/angular
44 | - test -z "$DEPLOY_DOCS" || rm -rf source/angular/api
45 | - test -z "$DEPLOY_DOCS" || cp -r ../docs source/angular/api
46 | - test -z "$DEPLOY_DOCS" || git add --all
47 | - test -z "$DEPLOY_DOCS" || git commit -m "stormpath-sdk-angular release $RELEASE_VERSION"
48 | - test -z "$DEPLOY_DOCS" || git push origin source
49 | matrix:
50 | include:
51 | - env: BUILD_DOCS=true
52 | node_js: node
53 | notifications:
54 | webhooks:
55 | on_success: change
56 | on_failure: always
57 | on_start: false
58 | env:
59 | global:
60 | - secure: Ql5jkxDVxmLRB+enk2SXT7ZuZQbAv0txQbMYv9iFOk/eezyA+joep3VAze7h8gDsC7eipUisuPNHa0wvJklpacTrNsUfK/HM/IPUwMNdyBEX+lk28L1oT199Aijj51KBH7OuIgnTHp6RP4SahonY9iBRyUhOlAcyan4aCYvMIr9sIvx9PJAPeO5/4olR9UnIIjPsLs8+xuh1nbnu/nb6BClA3wKriSe64K+vREl3x863BPTDzVDBCKbB5F5QTRuNSlJ7NT6JnbqqH6Dt5LQYwu/h4l3gFFMzROKzOcId62EfdMlpyH/akJqxqqKuCd9cQ3eo42wSIu3zD2eq3rhEj6g4WjKilMPxYIjEah3f+75qmby7U8qEJGsuyd1J0nWRXm0e+Uei9w9TVV+shjwH85QVz09w5ktOzZm595pV9v/2gx3dzbPZ/g/xHlhTcvFdxt587EDUEeejXKHFN2/kzQTqc04ZBJ5P2E0SbuoOGv6p030VsZFVuUlZaRcjempXOD7SuoRZ/6v7mpzvT/uHuQdJPzIEUejrLUnCbJ3k/VU9jXp0V88IAl+/vF/4h9e6zuo4eLcQ0Z9q4+hMRXZbiljSENty5tdgGzUfz3bwqWaL8AuFrDyA3wdlT1tqSIjbq1yvD9IzHRToq2jvjqlidbeDKwuh+GlF79+CTjlgV14=
61 | - secure: lLFXP0J7p1rwSAIYzTClDaS05Iv3w8uK1DysdqCFtS180QEP8KN5uWwJQ4+YPklrzPDrE7jN6JJgtDvch9+C4ea1Y/Tuvct3snslWyOCfrg0UKRKkNOv8n/QAgczjoTZkniCc/PElKCyYP1CRPv4jN4AyhOzgSVZ2dzm5+BnKsPf02U6dSn8SO37gOmJGinVPyXLzUpFgvShC5sz1zEahPhr87BM7yz2ImqgibXqPvHDlw0E0ZKYXoTB4w6jaVrl/R743rjJ7PNCvSs2AQT/MZoHBNHGJby3NdSmV4gOCxIhe/eu5AJ6Nu95GRy4q9ThxqlBILJseaQr8OII5ceQ5eaADgaZHqW0fVXZ3VSjdUgmxrZ8ZaVchrgZKDBbNG/tImcPAkjWP6YScUfyqPjaE21W/ckKuwq6mgtPR6mY2z1gQAie0q0mWlbWfGfXE0cvCo0z6Eyr7zsl5NS54ywdjtns8KaN+O2+SrgJbhHunxkKr3ZE/JWfmYyBie4Hb+7inmOcEFmDQJfQ5AaXiHONBnQAIq7RHE73jykpVNUog9nvD7jLSHpPj1+kHg0c18ADzApyP0BCtj42mEnfHlPpoRyrM7e4UxQtlt1WP7zOtWmF0HI9QJ6PcqG2qarC+HHwGs0dbtAU+itYvGcA4e2AD7N6rkbzHutP1ymixI+Krns=
62 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 |
5 |
6 | # [0.2.0](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.1.7...v0.2.0) (2017-11-21)
7 |
8 |
9 |
10 |
11 | ## [0.2.0](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.1.6...v0.2.0) (2017-11-21)
12 |
13 |
14 | ### Bug Fixes
15 |
16 | * **package.json:** Remove angular-cookie and webstorage from devDependencies ([833acbb](https://github.com/stormpath/stormpath-sdk-angular/commit/833acbb))
17 |
18 |
19 |
20 |
21 | ## [0.1.6](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.1.5...v0.1.6) (2017-02-04)
22 |
23 |
24 | ### Bug Fixes
25 |
26 | * **dependencies:** Remove Ionic pages and module ([a3e837b](https://github.com/stormpath/stormpath-sdk-angular/commit/a3e837b))
27 |
28 |
29 |
30 |
31 | ## [0.1.5](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.1.4...v0.1.5) (2017-02-03)
32 |
33 |
34 | ### Features
35 |
36 | * **templates:** Add pages for Ionic with Ionic components in templates ([4360bab](https://github.com/stormpath/stormpath-sdk-angular/commit/4360bab))
37 |
38 |
39 |
40 |
41 | ## [0.1.4](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.1.3...v0.1.4) (2017-01-30)
42 |
43 |
44 | ### Bug Fixes
45 |
46 | * **build:** Move ng2-webstorage and angular2-cookies to dependencies since they're required ([d05d730](https://github.com/stormpath/stormpath-sdk-angular/commit/d05d730)), closes [#62](https://github.com/stormpath/stormpath-sdk-angular/issues/62)
47 |
48 |
49 |
50 |
51 | ## [0.1.3](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.1.2...v0.1.3) (2017-01-30)
52 |
53 |
54 | ### Bug Fixes
55 |
56 | * **angular:** Change to peerDependencies and allow Angular 2.0.0+ ([cbf9637](https://github.com/stormpath/stormpath-sdk-angular/commit/cbf9637))
57 |
58 |
59 |
60 |
61 | ## [0.1.2](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.1.1...v0.1.2) (2017-01-27)
62 |
63 |
64 | ### Bug Fixes
65 |
66 | * **http:** Fix compatibility with Angular versions < 2.3 ([b3ae345](https://github.com/stormpath/stormpath-sdk-angular/commit/b3ae345))
67 | * **logout:** Fix logout fails when no access token found ([6fcaeda](https://github.com/stormpath/stormpath-sdk-angular/commit/6fcaeda))
68 |
69 |
70 |
71 |
72 | ## [0.1.1](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.1.0...v0.1.1) (2017-01-20)
73 |
74 |
75 | ### Bug Fixes
76 |
77 | * **config:** Allow autoAuthorizedUris to be modified ([#48](https://github.com/stormpath/stormpath-sdk-angular/issues/48)) ([ca81cbe](https://github.com/stormpath/stormpath-sdk-angular/commit/ca81cbe)), closes [#47](https://github.com/stormpath/stormpath-sdk-angular/issues/47)
78 | * **dependencies:** Lock down version of ng2-webstorage to 1.4.3. ([6b00209](https://github.com/stormpath/stormpath-sdk-angular/commit/6b00209)), closes [#46](https://github.com/stormpath/stormpath-sdk-angular/issues/46)
79 | * **security:** Set autocomplete="off" for all forms ([#52](https://github.com/stormpath/stormpath-sdk-angular/issues/52)) ([e85dc7d](https://github.com/stormpath/stormpath-sdk-angular/commit/e85dc7d)), closes [#51](https://github.com/stormpath/stormpath-sdk-angular/issues/51)
80 |
81 |
82 |
83 |
84 | ## [0.1.0](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.0.5...v0.1.0) (2017-01-12)
85 |
86 |
87 | ### Bug Fixes
88 |
89 | * **build:** Fix installation by downgrading to TypeScript 2.0.10. ([#45](https://github.com/stormpath/stormpath-sdk-angular/issues/45)) ([2ec5ae3](https://github.com/stormpath/stormpath-sdk-angular/commit/2ec5ae3))
90 | * **demo:** Fix logout link so event propogation is stopped ([7758ed2](https://github.com/stormpath/stormpath-sdk-angular/commit/7758ed2)), closes [#22](https://github.com/stormpath/stormpath-sdk-angular/issues/22)
91 | * **forms:** Add required field validation to login and forgot password forms. ([#40](https://github.com/stormpath/stormpath-sdk-angular/issues/40)) ([ca2f339](https://github.com/stormpath/stormpath-sdk-angular/commit/ca2f339)), closes [#24](https://github.com/stormpath/stormpath-sdk-angular/issues/24)
92 | * **webpack:** Change X-Stormpath-Agent to read versions from package.json and Angular ([8e3747e](https://github.com/stormpath/stormpath-sdk-angular/commit/8e3747e))
93 |
94 |
95 | ### Features
96 |
97 | * **oauth:** Add support for OAuth and Client API ([#37](https://github.com/stormpath/stormpath-sdk-angular/issues/37)) ([e18ed49](https://github.com/stormpath/stormpath-sdk-angular/commit/e18ed49))
98 | * **tests:** Add Protractor configuration and tests ([41c216a](https://github.com/stormpath/stormpath-sdk-angular/commit/41c216a))
99 |
100 |
101 | ### Performance Improvements
102 |
103 | * **webpack:** Upgrade to webpack 2 for better performance and ES6 ([9c8b345](https://github.com/stormpath/stormpath-sdk-angular/commit/9c8b345))
104 |
105 |
106 |
107 |
108 | ## [0.0.5](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.0.4...v0.0.5) (2016-12-14)
109 |
110 |
111 | ### Bug Fixes
112 |
113 | * **cors:** Use withCredentials: true for requests so CORS works ([991af7b](https://github.com/stormpath/stormpath-sdk-angular/commit/991af7b))
114 |
115 |
116 |
117 | ## [0.0.4](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.0.3...v0.0.4) (2016-12-06)
118 |
119 |
120 | ### Bug Fixes
121 |
122 | * resolving conflicted typedoc dependency ([da6fa97](https://github.com/stormpath/stormpath-sdk-angular/commit/da6fa97))
123 | * **templates:** Fixed 404 in templates by embedding them ([cd0d377](https://github.com/stormpath/stormpath-sdk-angular/commit/cd0d377))
124 | * **typedoc:** Fix typedoc listing of classes in right column ([0a464a4](https://github.com/stormpath/stormpath-sdk-angular/commit/0a464a4))
125 |
126 |
127 |
128 |
129 | ## [0.0.4](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.0.3...v0.0.4) (2016-12-06)
130 |
131 |
132 | ### Bug Fixes
133 |
134 | * **templates:** Fixed 404 in templates by embedding them ([98982c4](https://github.com/stormpath/stormpath-sdk-angular/commit/98982c4))
135 | * **typedoc:** Fix typedoc listing of classes in right column ([0a464a4](https://github.com/stormpath/stormpath-sdk-angular/commit/0a464a4))
136 |
137 |
138 | ## [0.0.3](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.0.2...v0.0.3) (2016-12-02)
139 |
140 |
141 | ### Features
142 |
143 | * Add support for overridding templates ([bc4e6b0](https://github.com/stormpath/stormpath-sdk-angular/commit/bc4e6b0))
144 |
145 |
146 | ## [0.0.2](https://github.com/stormpath/stormpath-sdk-angular/compare/v0.0.1...v0.0.2) (2016-11-11)
147 |
148 | ### Bug Fixes
149 |
150 | * Change user-agent to be stormpath-sdk-angular ([021d882](https://github.com/stormpath/stormpath-sdk-angular/commit/021d882))
151 |
152 |
153 | ## 0.0.1 (2016-11-10)
154 |
155 | * Initial Release
156 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2016 Stormpath
2 |
3 | Apache License
4 | Version 2.0, January 2004
5 | http://www.apache.org/licenses/
6 |
7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 |
9 | 1. Definitions.
10 |
11 | "License" shall mean the terms and conditions for use, reproduction,
12 | and distribution as defined by Sections 1 through 9 of this document.
13 |
14 | "Licensor" shall mean the copyright owner or entity authorized by
15 | the copyright owner that is granting the License.
16 |
17 | "Legal Entity" shall mean the union of the acting entity and all
18 | other entities that control, are controlled by, or are under common
19 | control with that entity. For the purposes of this definition,
20 | "control" means (i) the power, direct or indirect, to cause the
21 | direction or management of such entity, whether by contract or
22 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
23 | outstanding shares, or (iii) beneficial ownership of such entity.
24 |
25 | "You" (or "Your") shall mean an individual or Legal Entity
26 | exercising permissions granted by this License.
27 |
28 | "Source" form shall mean the preferred form for making modifications,
29 | including but not limited to software source code, documentation
30 | source, and configuration files.
31 |
32 | "Object" form shall mean any form resulting from mechanical
33 | transformation or translation of a Source form, including but
34 | not limited to compiled object code, generated documentation,
35 | and conversions to other media types.
36 |
37 | "Work" shall mean the work of authorship, whether in Source or
38 | Object form, made available under the License, as indicated by a
39 | copyright notice that is included in or attached to the work
40 | (an example is provided in the Appendix below).
41 |
42 | "Derivative Works" shall mean any work, whether in Source or Object
43 | form, that is based on (or derived from) the Work and for which the
44 | editorial revisions, annotations, elaborations, or other modifications
45 | represent, as a whole, an original work of authorship. For the purposes
46 | of this License, Derivative Works shall not include works that remain
47 | separable from, or merely link (or bind by name) to the interfaces of,
48 | the Work and Derivative Works thereof.
49 |
50 | "Contribution" shall mean any work of authorship, including
51 | the original version of the Work and any modifications or additions
52 | to that Work or Derivative Works thereof, that is intentionally
53 | submitted to Licensor for inclusion in the Work by the copyright owner
54 | or by an individual or Legal Entity authorized to submit on behalf of
55 | the copyright owner. For the purposes of this definition, "submitted"
56 | means any form of electronic, verbal, or written communication sent
57 | to the Licensor or its representatives, including but not limited to
58 | communication on electronic mailing lists, source code control systems,
59 | and issue tracking systems that are managed by, or on behalf of, the
60 | Licensor for the purpose of discussing and improving the Work, but
61 | excluding communication that is conspicuously marked or otherwise
62 | designated in writing by the copyright owner as "Not a Contribution."
63 |
64 | "Contributor" shall mean Licensor and any individual or Legal Entity
65 | on behalf of whom a Contribution has been received by Licensor and
66 | subsequently incorporated within the Work.
67 |
68 | 2. Grant of Copyright License. Subject to the terms and conditions of
69 | this License, each Contributor hereby grants to You a perpetual,
70 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71 | copyright license to reproduce, prepare Derivative Works of,
72 | publicly display, publicly perform, sublicense, and distribute the
73 | Work and such Derivative Works in Source or Object form.
74 |
75 | 3. Grant of Patent License. Subject to the terms and conditions of
76 | this License, each Contributor hereby grants to You a perpetual,
77 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78 | (except as stated in this section) patent license to make, have made,
79 | use, offer to sell, sell, import, and otherwise transfer the Work,
80 | where such license applies only to those patent claims licensable
81 | by such Contributor that are necessarily infringed by their
82 | Contribution(s) alone or by combination of their Contribution(s)
83 | with the Work to which such Contribution(s) was submitted. If You
84 | institute patent litigation against any entity (including a
85 | cross-claim or counterclaim in a lawsuit) alleging that the Work
86 | or a Contribution incorporated within the Work constitutes direct
87 | or contributory patent infringement, then any patent licenses
88 | granted to You under this License for that Work shall terminate
89 | as of the date such litigation is filed.
90 |
91 | 4. Redistribution. You may reproduce and distribute copies of the
92 | Work or Derivative Works thereof in any medium, with or without
93 | modifications, and in Source or Object form, provided that You
94 | meet the following conditions:
95 |
96 | (a) You must give any other recipients of the Work or
97 | Derivative Works a copy of this License; and
98 |
99 | (b) You must cause any modified files to carry prominent notices
100 | stating that You changed the files; and
101 |
102 | (c) You must retain, in the Source form of any Derivative Works
103 | that You distribute, all copyright, patent, trademark, and
104 | attribution notices from the Source form of the Work,
105 | excluding those notices that do not pertain to any part of
106 | the Derivative Works; and
107 |
108 | (d) If the Work includes a "NOTICE" text file as part of its
109 | distribution, then any Derivative Works that You distribute must
110 | include a readable copy of the attribution notices contained
111 | within such NOTICE file, excluding those notices that do not
112 | pertain to any part of the Derivative Works, in at least one
113 | of the following places: within a NOTICE text file distributed
114 | as part of the Derivative Works; within the Source form or
115 | documentation, if provided along with the Derivative Works; or,
116 | within a display generated by the Derivative Works, if and
117 | wherever such third-party notices normally appear. The contents
118 | of the NOTICE file are for informational purposes only and
119 | do not modify the License. You may add Your own attribution
120 | notices within Derivative Works that You distribute, alongside
121 | or as an addendum to the NOTICE text from the Work, provided
122 | that such additional attribution notices cannot be construed
123 | as modifying the License.
124 |
125 | You may add Your own copyright statement to Your modifications and
126 | may provide additional or different license terms and conditions
127 | for use, reproduction, or distribution of Your modifications, or
128 | for any such Derivative Works as a whole, provided Your use,
129 | reproduction, and distribution of the Work otherwise complies with
130 | the conditions stated in this License.
131 |
132 | 5. Submission of Contributions. Unless You explicitly state otherwise,
133 | any Contribution intentionally submitted for inclusion in the Work
134 | by You to the Licensor shall be under the terms and conditions of
135 | this License, without any additional terms or conditions.
136 | Notwithstanding the above, nothing herein shall supersede or modify
137 | the terms of any separate license agreement you may have executed
138 | with Licensor regarding such Contributions.
139 |
140 | 6. Trademarks. This License does not grant permission to use the trade
141 | names, trademarks, service marks, or product names of the Licensor,
142 | except as required for reasonable and customary use in describing the
143 | origin of the Work and reproducing the content of the NOTICE file.
144 |
145 | 7. Disclaimer of Warranty. Unless required by applicable law or
146 | agreed to in writing, Licensor provides the Work (and each
147 | Contributor provides its Contributions) on an "AS IS" BASIS,
148 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149 | implied, including, without limitation, any warranties or conditions
150 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151 | PARTICULAR PURPOSE. You are solely responsible for determining the
152 | appropriateness of using or redistributing the Work and assume any
153 | risks associated with Your exercise of permissions under this License.
154 |
155 | 8. Limitation of Liability. In no event and under no legal theory,
156 | whether in tort (including negligence), contract, or otherwise,
157 | unless required by applicable law (such as deliberate and grossly
158 | negligent acts) or agreed to in writing, shall any Contributor be
159 | liable to You for damages, including any direct, indirect, special,
160 | incidental, or consequential damages of any character arising as a
161 | result of this License or out of the use or inability to use the
162 | Work (including but not limited to damages for loss of goodwill,
163 | work stoppage, computer failure or malfunction, or any and all
164 | other commercial damages or losses), even if such Contributor
165 | has been advised of the possibility of such damages.
166 |
167 | 9. Accepting Warranty or Additional Liability. While redistributing
168 | the Work or Derivative Works thereof, You may choose to offer,
169 | and charge a fee for, acceptance of support, warranty, indemnity,
170 | or other liability obligations and/or rights consistent with this
171 | License. However, in accepting such obligations, You may act only
172 | on Your own behalf and on Your sole responsibility, not on behalf
173 | of any other Contributor, and only if You agree to indemnify,
174 | defend, and hold each Contributor harmless for any liability
175 | incurred by, or claims asserted against, such Contributor by reason
176 | of your accepting any such warranty or additional liability.
177 |
178 | END OF TERMS AND CONDITIONS
179 |
180 | APPENDIX: How to apply the Apache License to your work.
181 |
182 | To apply the Apache License to your work, attach the following
183 | boilerplate notice, with the fields enclosed by brackets "[]"
184 | replaced with your own identifying information. (Don't include
185 | the brackets!) The text should be enclosed in the appropriate
186 | comment syntax for the file format. We also recommend that a
187 | file or class name and description of purpose be included on the
188 | same "printed page" as the copyright notice for easier
189 | identification within third-party archives.
190 |
191 | Copyright [yyyy] [name of copyright owner]
192 |
193 | Licensed under the Apache License, Version 2.0 (the "License");
194 | you may not use this file except in compliance with the License.
195 | You may obtain a copy of the License at
196 |
197 | http://www.apache.org/licenses/LICENSE-2.0
198 |
199 | Unless required by applicable law or agreed to in writing, software
200 | distributed under the License is distributed on an "AS IS" BASIS,
201 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202 | See the License for the specific language governing permissions and
203 | limitations under the License.
204 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Stormpath is Joining Okta
2 | We are incredibly excited to announce that [Stormpath is joining forces with Okta](https://stormpath.com/blog/stormpaths-new-path?utm_source=github&utm_medium=readme&utm-campaign=okta-announcement). Please visit [the Migration FAQs](https://stormpath.com/oktaplusstormpath?utm_source=github&utm_medium=readme&utm-campaign=okta-announcement) for a detailed look at what this means for Stormpath users.
3 |
4 | We're available to answer all questions at [support@stormpath.com](mailto:support@stormpath.com).
5 |
6 | # Stormpath Angular SDK
7 | [](https://travis-ci.org/stormpath/stormpath-sdk-angular)
8 | [](http://badge.fury.io/js/angular-stormpath)
9 | [](https://david-dm.org/stormpath/stormpath-sdk-angular#info=devDependencies)
10 | [](https://github.com/stormpath/stormpath-sdk-angular/issues)
11 | [](https://github.com/stormpath/stormpath-sdk-angular/stargazers)
12 | [](https://raw.githubusercontent.com/stormpath/stormpath-sdk-angular/master/LICENSE)
13 |
14 | > Angular Components for integrating with Stormpath's API
15 |
16 |
60 |
61 | `
62 | })
63 | export class AppComponent extends AuthPortComponent {
64 | }
65 | ```
66 |
67 | If you're using a version of Angular < 2.3, extending AuthPortComponent won't work for you. As an alternative, you can inject the `Stormpath` service into your component, subscribe to `stormpath.user$` and implement `logout()` yourself.
68 |
69 | ```typescript
70 | import { Account, Stormpath } from 'angular-stormpath';
71 | ...
72 | export class AppComponent {
73 | user$: Observable;
74 |
75 | constructor(private stormpath: Stormpath) {
76 | this.user$ = this.stormpath.user$;
77 | }
78 |
79 | logout(): void {
80 | this.stormpath.logout();
81 | }
82 | }
83 | ```
84 |
85 | You may also find it useful to view the [demo source](https://github.com/stormpath/stormpath-sdk-angular/blob/master/demo/app.component.ts).
86 |
87 | ### Configuration
88 |
89 | To override the endpoint prefix or URIs for the various endpoints, you can modify the defaults in [StormpathConfiguration](https://github.com/stormpath/stormpath-sdk-angular/blob/master/src/stormpath/stormpath.config.ts).
90 |
91 | For example, to override the endpoint prefix and `/me` URI in [demo.module.ts](https://github.com/stormpath/stormpath-sdk-angular/blob/master/demo/demo.module.ts), change it to the following:
92 |
93 | ```typescript
94 | export function stormpathConfig(): StormpathConfiguration {
95 | let spConfig: StormpathConfiguration = new StormpathConfiguration();
96 | spConfig.endpointPrefix = 'http://api.mycompany.com';
97 | spConfig.meUri = '/account';
98 | return spConfig;
99 | }
100 |
101 | @NgModule({
102 | declarations: [AppComponent],
103 | imports: [BrowserModule, StormpathModule],
104 | bootstrap: [AppComponent],
105 | providers: [{
106 | provide: StormpathConfiguration, useFactory: stormpathConfig
107 | }]
108 | })
109 | export class DemoModule {
110 | }
111 | ```
112 |
113 | #### OAuth
114 |
115 | If your Angular app is on a different domain than your endpoints, OAuth will be used for login/logout. The access token will be stored in localStorage under the name `stormpath:token` and it will be automatically added as an `Authorization` header when you send HTTP requests to your `/me` endpoint.
116 |
117 | If you'd like to add this header to additional URLs, you'll need to add them as follows:
118 |
119 | ```typescript
120 | let config: StormpathConfiguration = new StormpathConfiguration();
121 | config.autoAuthorizedUris.push(new RegExp('http://localhost:3000/myapi/*)');
122 | ```
123 |
124 | #### Templates
125 |
126 | To override templates, you can use the `customTemplate` attribute on a component. Below is an example of [app.component.ts](https://github.com/stormpath/stormpath-sdk-angular/blob/master/demo/app.component.ts) with a custom `` and ``:
127 |
128 | ```typescript
129 | import { Component, OnInit } from '@angular/core';
130 | import { Observable } from 'rxjs/Observable';
131 | import { Stormpath, StormpathErrorResponse, Account, LoginFormModel } from 'angular-stormpath';
132 |
133 | @Component({
134 | selector: 'demo-app',
135 | template: `
11 | We have sent a password reset link to the email address of the account that you specified.
12 | Please check your email for this message, then click on the link.
13 |
14 |
15 |
16 |
17 |
18 |
33 |
34 |
35 |
36 |
38 | `
39 | })
40 | @Injectable()
41 | export class ForgotPasswordComponent implements OnInit {
42 | /**
43 | * A reference to a `` tag that if set will override this component's template. Use like so:
44 | * ```
45 | *
46 | * // custom HTML with login form
47 | *
48 | * ```
49 | * Then pass customTemplate to the `forgot-password-form` component like so `[customTemplate]="customTemplate"`
50 | */
51 | @Input() customTemplate: TemplateRef;
52 | protected forgotPasswordFormModel: ForgotPasswordFormModel;
53 | protected error: string;
54 | protected sent: boolean;
55 |
56 | constructor(public stormpath: Stormpath) {
57 | this.sent = false;
58 | }
59 |
60 | ngOnInit(): void {
61 | this.forgotPasswordFormModel = {
62 | email: ''
63 | };
64 | }
65 |
66 | send(): void {
67 | this.error = null;
68 | this.stormpath.sendPasswordResetEmail(this.forgotPasswordFormModel)
69 | .subscribe(() => this.sent = true,
70 | (error: StormpathErrorResponse) => this.error = error.message);
71 | }
72 |
73 | onSubmit(form: any): void {
74 | this.send();
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/forgot-password/index.ts:
--------------------------------------------------------------------------------
1 | export * from './forgot-password.component';
2 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './stormpath.module';
2 |
3 | // all components that will be codegen'd need to be exported for AOT to work
4 | export * from './authport/index';
5 | export * from './email-verification/index';
6 | export * from './forgot-password/index';
7 | export * from './login/index';
8 | export * from './register/index';
9 | export * from './resend-email-verification/index';
10 | export * from './reset-password/index';
11 | export * from './shared/index';
12 | export * from './stormpath/index';
13 |
--------------------------------------------------------------------------------
/src/login/index.ts:
--------------------------------------------------------------------------------
1 | export * from './login.component';
2 |
--------------------------------------------------------------------------------
/src/login/login.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, TemplateRef, Input } from '@angular/core';
2 | import { Injectable } from '@angular/core';
3 | import { Observable } from 'rxjs/Observable';
4 | import { Account } from '../shared/account';
5 | import {
6 | Stormpath, LoginFormModel, LoginService, StormpathErrorResponse
7 | } from '../stormpath/stormpath.service';
8 |
9 | @Component({
10 | selector: 'login-form',
11 | template: `
12 |
35 |
36 |
38 | `
39 | })
40 | @Injectable()
41 | export class LoginComponent implements OnInit {
42 | /**
43 | * A reference to a `` tag that if set will override this component's template. Use like so:
44 | * ```
45 | *
46 | * // custom HTML with login form
47 | *
48 | * ```
49 | * Then pass customTemplate to the `login-form` component like so `[customTemplate]="customTemplate"`
50 | */
51 | @Input() customTemplate: TemplateRef;
52 |
53 | protected loginFormModel: LoginFormModel;
54 | protected user$: Observable;
55 | protected loggedIn$: Observable;
56 | protected error: string;
57 |
58 | constructor(public stormpath: Stormpath, public loginService: LoginService) {
59 | }
60 |
61 | ngOnInit(): void {
62 | this.user$ = this.stormpath.user$;
63 | this.loggedIn$ = this.user$.map(user => !!user);
64 | this.loginFormModel = {
65 | login: '',
66 | password: ''
67 | };
68 | }
69 |
70 | login(form: any): void {
71 | this.error = null;
72 | this.stormpath.login(this.loginFormModel)
73 | .subscribe(null, (error: StormpathErrorResponse) => {
74 | this.error = error.message;
75 | });
76 | }
77 |
78 | forgot(): void {
79 | this.loginService.forgotPassword();
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/register/index.ts:
--------------------------------------------------------------------------------
1 | export * from './register.component';
2 |
--------------------------------------------------------------------------------
/src/register/register.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, Input, OnInit, TemplateRef } from '@angular/core';
2 | import { Injectable } from '@angular/core';
3 | import { Observable } from 'rxjs/Observable';
4 |
5 | import { Account } from '../shared/account';
6 | import { Stormpath, LoginFormModel, RegistrationFormModel } from '../stormpath/stormpath.service';
7 |
8 | @Component({
9 | selector: 'register-form',
10 | template: `
11 |
22 |
23 | Your account has been created and requires verification.
24 | Please check your email for a verification link.
25 |
26 |
27 | Your account has been created, you may now log in.
28 |
29 |
30 |
32 | `
33 | })
34 | @Injectable()
35 | export class RegisterComponent implements OnInit {
36 | /**
37 | * A reference to a `` tag that if set will override this component's template. Use like so:
38 | * ```
39 | *
40 | * // custom HTML with login form
41 | *
42 | * ```
43 | * Then pass customTemplate to the `register-form` component like so `[customTemplate]="customTemplate"`
44 | */
45 | @Input() customTemplate: TemplateRef;
46 | @Input() autoLogin: boolean;
47 | protected model: Object;
48 | protected error: string;
49 | protected viewModel$: Observable