@celljs/oauth2-client 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/cell.yml +57 -0
- package/lib/node/authentication/authentication-protocol.d.ts +25 -0
- package/lib/node/authentication/authentication-protocol.d.ts.map +1 -0
- package/lib/node/authentication/authentication-protocol.js +11 -0
- package/lib/node/authentication/authentication-protocol.js.map +1 -0
- package/lib/node/authentication/index.d.ts +4 -0
- package/lib/node/authentication/index.d.ts.map +1 -0
- package/lib/node/authentication/index.js +20 -0
- package/lib/node/authentication/index.js.map +1 -0
- package/lib/node/authentication/oauth2-authentication-provider.d.ts +30 -0
- package/lib/node/authentication/oauth2-authentication-provider.d.ts.map +1 -0
- package/lib/node/authentication/oauth2-authentication-provider.js +170 -0
- package/lib/node/authentication/oauth2-authentication-provider.js.map +1 -0
- package/lib/node/authentication/oidc-authentication-provider.d.ts +18 -0
- package/lib/node/authentication/oidc-authentication-provider.d.ts.map +1 -0
- package/lib/node/authentication/oidc-authentication-provider.js +74 -0
- package/lib/node/authentication/oidc-authentication-provider.js.map +1 -0
- package/lib/node/authorization/authorization-code-authorized-client-provider.d.ts +5 -0
- package/lib/node/authorization/authorization-code-authorized-client-provider.d.ts.map +1 -0
- package/lib/node/authorization/authorization-code-authorized-client-provider.js +27 -0
- package/lib/node/authorization/authorization-code-authorized-client-provider.js.map +1 -0
- package/lib/node/authorization/authorization-code-grant-middleware.d.ts +26 -0
- package/lib/node/authorization/authorization-code-grant-middleware.d.ts.map +1 -0
- package/lib/node/authorization/authorization-code-grant-middleware.js +129 -0
- package/lib/node/authorization/authorization-code-grant-middleware.js.map +1 -0
- package/lib/node/authorization/authorization-failure-handler.d.ts +10 -0
- package/lib/node/authorization/authorization-failure-handler.d.ts.map +1 -0
- package/lib/node/authorization/authorization-failure-handler.js +35 -0
- package/lib/node/authorization/authorization-failure-handler.js.map +1 -0
- package/lib/node/authorization/authorization-protocol.d.ts +78 -0
- package/lib/node/authorization/authorization-protocol.d.ts.map +1 -0
- package/lib/node/authorization/authorization-protocol.js +34 -0
- package/lib/node/authorization/authorization-protocol.js.map +1 -0
- package/lib/node/authorization/authorization-request-manager.d.ts +13 -0
- package/lib/node/authorization/authorization-request-manager.d.ts.map +1 -0
- package/lib/node/authorization/authorization-request-manager.js +64 -0
- package/lib/node/authorization/authorization-request-manager.js.map +1 -0
- package/lib/node/authorization/authorization-request-redirect-middleware.d.ts +20 -0
- package/lib/node/authorization/authorization-request-redirect-middleware.d.ts.map +1 -0
- package/lib/node/authorization/authorization-request-redirect-middleware.js +113 -0
- package/lib/node/authorization/authorization-request-redirect-middleware.js.map +1 -0
- package/lib/node/authorization/authorization-request-resolver.d.ts +38 -0
- package/lib/node/authorization/authorization-request-resolver.d.ts.map +1 -0
- package/lib/node/authorization/authorization-request-resolver.js +155 -0
- package/lib/node/authorization/authorization-request-resolver.js.map +1 -0
- package/lib/node/authorization/authorization-success-handler.d.ts +7 -0
- package/lib/node/authorization/authorization-success-handler.d.ts.map +1 -0
- package/lib/node/authorization/authorization-success-handler.js +28 -0
- package/lib/node/authorization/authorization-success-handler.js.map +1 -0
- package/lib/node/authorization/authorized-client-manager.d.ts +11 -0
- package/lib/node/authorization/authorized-client-manager.d.ts.map +1 -0
- package/lib/node/authorization/authorized-client-manager.js +48 -0
- package/lib/node/authorization/authorized-client-manager.js.map +1 -0
- package/lib/node/authorization/authorized-client-service.d.ts +12 -0
- package/lib/node/authorization/authorized-client-service.d.ts.map +1 -0
- package/lib/node/authorization/authorized-client-service.js +87 -0
- package/lib/node/authorization/authorized-client-service.js.map +1 -0
- package/lib/node/authorization/client-credentials-authorized-client-provider.d.ts +12 -0
- package/lib/node/authorization/client-credentials-authorized-client-provider.d.ts.map +1 -0
- package/lib/node/authorization/client-credentials-authorized-client-provider.js +72 -0
- package/lib/node/authorization/client-credentials-authorized-client-provider.js.map +1 -0
- package/lib/node/authorization/context-attributes-mapper.d.ts +5 -0
- package/lib/node/authorization/context-attributes-mapper.d.ts.map +1 -0
- package/lib/node/authorization/context-attributes-mapper.js +28 -0
- package/lib/node/authorization/context-attributes-mapper.js.map +1 -0
- package/lib/node/authorization/index.d.ts +14 -0
- package/lib/node/authorization/index.d.ts.map +1 -0
- package/lib/node/authorization/index.js +30 -0
- package/lib/node/authorization/index.js.map +1 -0
- package/lib/node/authorization/password-authorized-client-provider.d.ts +12 -0
- package/lib/node/authorization/password-authorized-client-provider.d.ts.map +1 -0
- package/lib/node/authorization/password-authorized-client-provider.js +85 -0
- package/lib/node/authorization/password-authorized-client-provider.js.map +1 -0
- package/lib/node/authorization/refresh-token-authorized-client-provider.d.ts +12 -0
- package/lib/node/authorization/refresh-token-authorized-client-provider.d.ts.map +1 -0
- package/lib/node/authorization/refresh-token-authorized-client-provider.js +68 -0
- package/lib/node/authorization/refresh-token-authorized-client-provider.js.map +1 -0
- package/lib/node/constants.d.ts +5 -0
- package/lib/node/constants.d.ts.map +1 -0
- package/lib/node/constants.js +8 -0
- package/lib/node/constants.js.map +1 -0
- package/lib/node/endpoint/authorization-code-token-response-client.d.ts +12 -0
- package/lib/node/endpoint/authorization-code-token-response-client.d.ts.map +1 -0
- package/lib/node/endpoint/authorization-code-token-response-client.js +83 -0
- package/lib/node/endpoint/authorization-code-token-response-client.js.map +1 -0
- package/lib/node/endpoint/client-credentials-token-response-client.d.ts +12 -0
- package/lib/node/endpoint/client-credentials-token-response-client.d.ts.map +1 -0
- package/lib/node/endpoint/client-credentials-token-response-client.js +80 -0
- package/lib/node/endpoint/client-credentials-token-response-client.js.map +1 -0
- package/lib/node/endpoint/endpoint-protocol.d.ts +48 -0
- package/lib/node/endpoint/endpoint-protocol.d.ts.map +1 -0
- package/lib/node/endpoint/endpoint-protocol.js +9 -0
- package/lib/node/endpoint/endpoint-protocol.js.map +1 -0
- package/lib/node/endpoint/index.d.ts +7 -0
- package/lib/node/endpoint/index.d.ts.map +1 -0
- package/lib/node/endpoint/index.js +23 -0
- package/lib/node/endpoint/index.js.map +1 -0
- package/lib/node/endpoint/password-token-response-client.d.ts +12 -0
- package/lib/node/endpoint/password-token-response-client.d.ts.map +1 -0
- package/lib/node/endpoint/password-token-response-client.js +82 -0
- package/lib/node/endpoint/password-token-response-client.js.map +1 -0
- package/lib/node/endpoint/refresh-token-token-response-client.d.ts +12 -0
- package/lib/node/endpoint/refresh-token-token-response-client.d.ts.map +1 -0
- package/lib/node/endpoint/refresh-token-token-response-client.js +87 -0
- package/lib/node/endpoint/refresh-token-token-response-client.js.map +1 -0
- package/lib/node/endpoint/user-response-client.d.ts +9 -0
- package/lib/node/endpoint/user-response-client.d.ts.map +1 -0
- package/lib/node/endpoint/user-response-client.js +84 -0
- package/lib/node/endpoint/user-response-client.js.map +1 -0
- package/lib/node/error/error-hander.d.ts +11 -0
- package/lib/node/error/error-hander.d.ts.map +1 -0
- package/lib/node/error/error-hander.js +52 -0
- package/lib/node/error/error-hander.js.map +1 -0
- package/lib/node/error/error-protocol.d.ts +3 -0
- package/lib/node/error/error-protocol.d.ts.map +1 -0
- package/lib/node/error/error-protocol.js +7 -0
- package/lib/node/error/error-protocol.js.map +1 -0
- package/lib/node/error/error.d.ts +10 -0
- package/lib/node/error/error.d.ts.map +1 -0
- package/lib/node/error/error.js +23 -0
- package/lib/node/error/error.js.map +1 -0
- package/lib/node/error/index.d.ts +4 -0
- package/lib/node/error/index.d.ts.map +1 -0
- package/lib/node/error/index.js +20 -0
- package/lib/node/error/index.js.map +1 -0
- package/lib/node/index.d.ts +8 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +24 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/module.d.ts +4 -0
- package/lib/node/module.d.ts.map +1 -0
- package/lib/node/module.js +6 -0
- package/lib/node/module.js.map +1 -0
- package/lib/node/provider/index.d.ts +3 -0
- package/lib/node/provider/index.d.ts.map +1 -0
- package/lib/node/provider/index.js +19 -0
- package/lib/node/provider/index.js.map +1 -0
- package/lib/node/provider/provider-details-manager.d.ts +12 -0
- package/lib/node/provider/provider-details-manager.d.ts.map +1 -0
- package/lib/node/provider/provider-details-manager.js +50 -0
- package/lib/node/provider/provider-details-manager.js.map +1 -0
- package/lib/node/provider/provider-protocol.d.ts +21 -0
- package/lib/node/provider/provider-protocol.d.ts.map +1 -0
- package/lib/node/provider/provider-protocol.js +5 -0
- package/lib/node/provider/provider-protocol.js.map +1 -0
- package/lib/node/registration/id-token-jwt-decoder-facatory.d.ts +15 -0
- package/lib/node/registration/id-token-jwt-decoder-facatory.d.ts.map +1 -0
- package/lib/node/registration/id-token-jwt-decoder-facatory.js +89 -0
- package/lib/node/registration/id-token-jwt-decoder-facatory.js.map +1 -0
- package/lib/node/registration/index.d.ts +5 -0
- package/lib/node/registration/index.d.ts.map +1 -0
- package/lib/node/registration/index.js +21 -0
- package/lib/node/registration/index.js.map +1 -0
- package/lib/node/registration/jws-algorithm-resolver.d.ts +5 -0
- package/lib/node/registration/jws-algorithm-resolver.d.ts.map +1 -0
- package/lib/node/registration/jws-algorithm-resolver.js +22 -0
- package/lib/node/registration/jws-algorithm-resolver.js.map +1 -0
- package/lib/node/registration/registration-manager.d.ts +15 -0
- package/lib/node/registration/registration-manager.d.ts.map +1 -0
- package/lib/node/registration/registration-manager.js +64 -0
- package/lib/node/registration/registration-manager.js.map +1 -0
- package/lib/node/registration/registration-protocol.d.ts +22 -0
- package/lib/node/registration/registration-protocol.d.ts.map +1 -0
- package/lib/node/registration/registration-protocol.js +7 -0
- package/lib/node/registration/registration-protocol.js.map +1 -0
- package/lib/node/user/index.d.ts +4 -0
- package/lib/node/user/index.d.ts.map +1 -0
- package/lib/node/user/index.js +20 -0
- package/lib/node/user/index.js.map +1 -0
- package/lib/node/user/oauth2-user-service.d.ts +10 -0
- package/lib/node/user/oauth2-user-service.d.ts.map +1 -0
- package/lib/node/user/oauth2-user-service.js +61 -0
- package/lib/node/user/oauth2-user-service.js.map +1 -0
- package/lib/node/user/oidc-user-service.d.ts +13 -0
- package/lib/node/user/oidc-user-service.d.ts.map +1 -0
- package/lib/node/user/oidc-user-service.js +98 -0
- package/lib/node/user/oidc-user-service.js.map +1 -0
- package/lib/node/user/user-protocol.d.ts +6 -0
- package/lib/node/user/user-protocol.d.ts.map +1 -0
- package/lib/node/user/user-protocol.js +3 -0
- package/lib/node/user/user-protocol.js.map +1 -0
- package/lib/node/utils/authorization-grant-request-entity-util.d.ts +10 -0
- package/lib/node/utils/authorization-grant-request-entity-util.d.ts.map +1 -0
- package/lib/node/utils/authorization-grant-request-entity-util.js +28 -0
- package/lib/node/utils/authorization-grant-request-entity-util.js.map +1 -0
- package/lib/node/utils/authorization-response-util.d.ts +8 -0
- package/lib/node/utils/authorization-response-util.d.ts.map +1 -0
- package/lib/node/utils/authorization-response-util.js +53 -0
- package/lib/node/utils/authorization-response-util.js.map +1 -0
- package/lib/node/utils/index.d.ts +3 -0
- package/lib/node/utils/index.d.ts.map +1 -0
- package/lib/node/utils/index.js +19 -0
- package/lib/node/utils/index.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +4 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +51 -0
- package/src/node/authentication/authentication-protocol.ts +26 -0
- package/src/node/authentication/index.ts +3 -0
- package/src/node/authentication/oauth2-authentication-provider.ts +163 -0
- package/src/node/authentication/oidc-authentication-provider.ts +60 -0
- package/src/node/authorization/authorization-code-authorized-client-provider.ts +16 -0
- package/src/node/authorization/authorization-code-grant-middleware.ts +110 -0
- package/src/node/authorization/authorization-failure-handler.ts +23 -0
- package/src/node/authorization/authorization-protocol.ts +104 -0
- package/src/node/authorization/authorization-request-manager.ts +54 -0
- package/src/node/authorization/authorization-request-redirect-middleware.ts +91 -0
- package/src/node/authorization/authorization-request-resolver.ts +149 -0
- package/src/node/authorization/authorization-success-handler.ts +15 -0
- package/src/node/authorization/authorized-client-manager.ts +35 -0
- package/src/node/authorization/authorized-client-service.ts +73 -0
- package/src/node/authorization/client-credentials-authorized-client-provider.ts +61 -0
- package/src/node/authorization/context-attributes-mapper.ts +18 -0
- package/src/node/authorization/index.ts +13 -0
- package/src/node/authorization/password-authorized-client-provider.ts +78 -0
- package/src/node/authorization/refresh-token-authorized-client-provider.ts +58 -0
- package/src/node/constants.ts +4 -0
- package/src/node/endpoint/authorization-code-token-response-client.ts +73 -0
- package/src/node/endpoint/client-credentials-token-response-client.ts +69 -0
- package/src/node/endpoint/endpoint-protocol.ts +55 -0
- package/src/node/endpoint/index.ts +6 -0
- package/src/node/endpoint/password-token-response-client.ts +71 -0
- package/src/node/endpoint/refresh-token-token-response-client.ts +77 -0
- package/src/node/endpoint/user-response-client.ts +72 -0
- package/src/node/error/error-hander.ts +39 -0
- package/src/node/error/error-protocol.ts +6 -0
- package/src/node/error/error.ts +19 -0
- package/src/node/error/index.ts +3 -0
- package/src/node/index.ts +7 -0
- package/src/node/module.ts +4 -0
- package/src/node/provider/index.ts +2 -0
- package/src/node/provider/provider-details-manager.ts +33 -0
- package/src/node/provider/provider-protocol.ts +24 -0
- package/src/node/registration/id-token-jwt-decoder-facatory.ts +71 -0
- package/src/node/registration/index.ts +4 -0
- package/src/node/registration/jws-algorithm-resolver.ts +12 -0
- package/src/node/registration/registration-manager.ts +47 -0
- package/src/node/registration/registration-protocol.ts +27 -0
- package/src/node/user/index.ts +3 -0
- package/src/node/user/oauth2-user-service.ts +50 -0
- package/src/node/user/oidc-user-service.ts +92 -0
- package/src/node/user/user-protocol.ts +6 -0
- package/src/node/utils/authorization-grant-request-entity-util.ts +26 -0
- package/src/node/utils/authorization-response-util.ts +50 -0
- package/src/node/utils/index.ts +2 -0
- package/src/package.spec.ts +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Cellbang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Cell - Oauth2 Client Component
|
package/cell.yml
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
cell:
|
|
2
|
+
oauth2:
|
|
3
|
+
client:
|
|
4
|
+
clockSkew: 60000 # 60s
|
|
5
|
+
redirectLoginPath: /login/oauth2/code/*
|
|
6
|
+
authorizationRequestBaseUri: /oauth2/authorization
|
|
7
|
+
defaultRedirectUri: ${cell.server.endpoint}${cell.server.path}{action}/oauth2/code/{registrationId}
|
|
8
|
+
authorizationCodeGrantUri: /*
|
|
9
|
+
registrationTemplates:
|
|
10
|
+
google:
|
|
11
|
+
scopes: [ openid, profile, email ]
|
|
12
|
+
redirectUri: ${cell.oauth2.client.defaultRedirectUri}
|
|
13
|
+
authorizationGrantType: authorization_code
|
|
14
|
+
clientAuthenticationMethod: basic
|
|
15
|
+
clientName: Google
|
|
16
|
+
github:
|
|
17
|
+
scopes: [ read:user ]
|
|
18
|
+
redirectUri: ${cell.oauth2.client.defaultRedirectUri}
|
|
19
|
+
authorizationGrantType: authorization_code
|
|
20
|
+
clientAuthenticationMethod: basic
|
|
21
|
+
clientName: GitHub
|
|
22
|
+
facebook:
|
|
23
|
+
scopes: [ public_profile, email ]
|
|
24
|
+
redirectUri: ${cell.oauth2.client.defaultRedirectUri}
|
|
25
|
+
authorizationGrantType: authorization_code
|
|
26
|
+
clientAuthenticationMethod: post
|
|
27
|
+
clientName: Facebook
|
|
28
|
+
okta:
|
|
29
|
+
scopes: [ openid, profile, email ]
|
|
30
|
+
redirectUri: ${cell.oauth2.client.defaultRedirectUri}
|
|
31
|
+
authorizationGrantType: authorization_code
|
|
32
|
+
clientAuthenticationMethod: basic
|
|
33
|
+
clientName: Facebook
|
|
34
|
+
providerTemplates:
|
|
35
|
+
google:
|
|
36
|
+
authorizationUri: https://accounts.google.com/o/oauth2/v2/auth
|
|
37
|
+
tokenUri: https://www.googleapis.com/oauth2/v4/token
|
|
38
|
+
userInfoEndpoint:
|
|
39
|
+
uri: https://www.googleapis.com/oauth2/v3/userinfo
|
|
40
|
+
userNameAttributeName: sub
|
|
41
|
+
jwkSetUri: https://www.googleapis.com/oauth2/v3/certs
|
|
42
|
+
issuerUri: https://accounts.google.com
|
|
43
|
+
github:
|
|
44
|
+
authorizationUri: https://github.com/login/oauth/authorize
|
|
45
|
+
tokenUri: https://github.com/login/oauth/access_token
|
|
46
|
+
userInfoEndpoint:
|
|
47
|
+
uri: https://api.github.com/user
|
|
48
|
+
userNameAttributeName: id
|
|
49
|
+
facebook:
|
|
50
|
+
authorizationUri: https://www.facebook.com/v2.8/dialog/oauth
|
|
51
|
+
tokenUri: https://graph.facebook.com/v2.8/oauth/access_token
|
|
52
|
+
userInfoEndpoint:
|
|
53
|
+
uri: https://graph.facebook.com/me?fields=id,name,email
|
|
54
|
+
userNameAttributeName: id
|
|
55
|
+
okta:
|
|
56
|
+
userInfoEndpoint:
|
|
57
|
+
userNameAttributeName: sub
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Authentication } from '@celljs/security/lib/node';
|
|
2
|
+
import { ClientRegistration } from '../registration';
|
|
3
|
+
import { AuthorizationExchange, AccessToken, RefreshToken } from '@celljs/oauth2-core';
|
|
4
|
+
export declare const INVALID_ID_TOKEN_ERROR_CODE = "invalid_id_token";
|
|
5
|
+
export declare const INVALID_NONCE_ERROR_CODE = "invalid_nonce";
|
|
6
|
+
export declare const AUTHORIZATION_REQUEST_NOT_FOUND_ERROR_CODE = "authorization_request_not_found";
|
|
7
|
+
export declare const CLIENT_REGISTRATION_NOT_FOUND_ERROR_CODE = "client_registration_not_found";
|
|
8
|
+
export declare const OAUTH2_AUTHENTICATION_PROVIDER_PRIORITY: number;
|
|
9
|
+
export declare const OIDC_AUTHENTICATION_PROVIDER_PRIORITY: number;
|
|
10
|
+
export interface OAuth2LoginAuthentication extends Authentication {
|
|
11
|
+
clientRegistration: ClientRegistration;
|
|
12
|
+
authorizationExchange: AuthorizationExchange;
|
|
13
|
+
accessToken: AccessToken;
|
|
14
|
+
refreshToken?: RefreshToken;
|
|
15
|
+
}
|
|
16
|
+
export interface OAuth2AuthorizationCodeAuthentication extends Authentication {
|
|
17
|
+
clientRegistration: ClientRegistration;
|
|
18
|
+
authorizationExchange: AuthorizationExchange;
|
|
19
|
+
accessToken: AccessToken;
|
|
20
|
+
refreshToken?: RefreshToken;
|
|
21
|
+
additionalParameters: {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=authentication-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication-protocol.d.ts","sourceRoot":"","sources":["../../../src/node/authentication/authentication-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAsD,MAAM,2BAA2B,CAAC;AAC/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEvF,eAAO,MAAM,2BAA2B,qBAAqB,CAAC;AAC9D,eAAO,MAAM,wBAAwB,kBAAkB,CAAC;AACxD,eAAO,MAAM,0CAA0C,oCAAoC,CAAC;AAC5F,eAAO,MAAM,wCAAwC,kCAAkC,CAAC;AAExF,eAAO,MAAM,uCAAuC,QAA2D,CAAC;AAChH,eAAO,MAAM,qCAAqC,QAAgD,CAAC;AAEnG,MAAM,WAAW,yBAA0B,SAAQ,cAAc;IAC7D,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAED,MAAM,WAAW,qCAAsC,SAAQ,cAAc;IACzE,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,oBAAoB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CAChD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OIDC_AUTHENTICATION_PROVIDER_PRIORITY = exports.OAUTH2_AUTHENTICATION_PROVIDER_PRIORITY = exports.CLIENT_REGISTRATION_NOT_FOUND_ERROR_CODE = exports.AUTHORIZATION_REQUEST_NOT_FOUND_ERROR_CODE = exports.INVALID_NONCE_ERROR_CODE = exports.INVALID_ID_TOKEN_ERROR_CODE = void 0;
|
|
4
|
+
const node_1 = require("@celljs/security/lib/node");
|
|
5
|
+
exports.INVALID_ID_TOKEN_ERROR_CODE = 'invalid_id_token';
|
|
6
|
+
exports.INVALID_NONCE_ERROR_CODE = 'invalid_nonce';
|
|
7
|
+
exports.AUTHORIZATION_REQUEST_NOT_FOUND_ERROR_CODE = 'authorization_request_not_found';
|
|
8
|
+
exports.CLIENT_REGISTRATION_NOT_FOUND_ERROR_CODE = 'client_registration_not_found';
|
|
9
|
+
exports.OAUTH2_AUTHENTICATION_PROVIDER_PRIORITY = node_1.USERNAME_PASSWORD_AUTHENTICATION_PROVIDER_PRIORITY + 100;
|
|
10
|
+
exports.OIDC_AUTHENTICATION_PROVIDER_PRIORITY = exports.OAUTH2_AUTHENTICATION_PROVIDER_PRIORITY + 100;
|
|
11
|
+
//# sourceMappingURL=authentication-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication-protocol.js","sourceRoot":"","sources":["../../../src/node/authentication/authentication-protocol.ts"],"names":[],"mappings":";;;AAAA,oDAA+G;AAIlG,QAAA,2BAA2B,GAAG,kBAAkB,CAAC;AACjD,QAAA,wBAAwB,GAAG,eAAe,CAAC;AAC3C,QAAA,0CAA0C,GAAG,iCAAiC,CAAC;AAC/E,QAAA,wCAAwC,GAAG,+BAA+B,CAAC;AAE3E,QAAA,uCAAuC,GAAG,yDAAkD,GAAG,GAAG,CAAC;AACnG,QAAA,qCAAqC,GAAG,+CAAuC,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/authentication/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./authentication-protocol"), exports);
|
|
18
|
+
__exportStar(require("./oidc-authentication-provider"), exports);
|
|
19
|
+
__exportStar(require("./oauth2-authentication-provider"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/authentication/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,iEAA+C;AAC/C,mEAAiD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RequestMatcher } from '@celljs/web/lib/node';
|
|
2
|
+
import { PathResolver } from '@celljs/web';
|
|
3
|
+
import { AuthorizationRequest, AccessTokenResponse } from '@celljs/oauth2-core';
|
|
4
|
+
import { AuthorizationRequestManager, AuthorizedClientManager, AuthorizedClient } from '../authorization';
|
|
5
|
+
import { ClientRegistration, ClientRegistrationManager } from '../registration';
|
|
6
|
+
import { AuthorizationCodeTokenResponseClient, OAuth2UserRequest } from '../endpoint';
|
|
7
|
+
import { AuthenticationProvider, UserChecker, UserService, UserMapper } from '@celljs/security/lib/node';
|
|
8
|
+
import { User } from '@celljs/security';
|
|
9
|
+
import { OAuth2LoginAuthentication } from './authentication-protocol';
|
|
10
|
+
export declare class OAuth2AuthenticationProvider implements AuthenticationProvider {
|
|
11
|
+
protected readonly options: any;
|
|
12
|
+
protected readonly authorizationRequestManager: AuthorizationRequestManager<AuthorizationRequest>;
|
|
13
|
+
protected readonly clientRegistrationManager: ClientRegistrationManager;
|
|
14
|
+
protected readonly authorizedClientManager: AuthorizedClientManager<AuthorizedClient>;
|
|
15
|
+
protected readonly userService: UserService<OAuth2UserRequest, User>;
|
|
16
|
+
protected readonly userChecker: UserChecker;
|
|
17
|
+
protected readonly userMapper: UserMapper;
|
|
18
|
+
protected readonly authorizationCodeTokenResponseClient: AuthorizationCodeTokenResponseClient;
|
|
19
|
+
protected readonly requestMatcher: RequestMatcher;
|
|
20
|
+
protected readonly pathResolver: PathResolver;
|
|
21
|
+
protected readonly endpoint: string;
|
|
22
|
+
priority: number;
|
|
23
|
+
protected checkScopes(scopes: string[]): boolean;
|
|
24
|
+
protected getUserinfo(clientRegistration: ClientRegistration, tokenResponse: AccessTokenResponse, additionalParameters: {
|
|
25
|
+
[key: string]: string;
|
|
26
|
+
}): Promise<User>;
|
|
27
|
+
authenticate(): Promise<OAuth2LoginAuthentication | undefined>;
|
|
28
|
+
support(): Promise<boolean>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=oauth2-authentication-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth2-authentication-provider.d.ts","sourceRoot":"","sources":["../../../src/node/authentication/oauth2-authentication-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAY,MAAM,aAAa,CAAC;AAErD,OAAO,EAA6B,oBAAoB,EACtB,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,gBAAgB,EAAsC,MAAM,kBAAk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AE,mBAAmB,EAAE,oBAAoB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE;IAQ3I,YAAY,IAAI,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC;IAoF9D,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;CAIpC"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OAuth2AuthenticationProvider = void 0;
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
const node_1 = require("@celljs/web/lib/node");
|
|
15
|
+
const web_1 = require("@celljs/web");
|
|
16
|
+
const utils_1 = require("../utils");
|
|
17
|
+
const oauth2_core_1 = require("@celljs/oauth2-core");
|
|
18
|
+
const authorization_1 = require("../authorization");
|
|
19
|
+
const registration_1 = require("../registration");
|
|
20
|
+
const endpoint_1 = require("../endpoint");
|
|
21
|
+
const node_2 = require("@celljs/security/lib/node");
|
|
22
|
+
const authentication_protocol_1 = require("./authentication-protocol");
|
|
23
|
+
const user_1 = require("../user");
|
|
24
|
+
let OAuth2AuthenticationProvider = class OAuth2AuthenticationProvider {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.priority = authentication_protocol_1.OAUTH2_AUTHENTICATION_PROVIDER_PRIORITY;
|
|
27
|
+
}
|
|
28
|
+
checkScopes(scopes) {
|
|
29
|
+
// Section 3.1.2.1 Authentication Request -
|
|
30
|
+
// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest scope
|
|
31
|
+
// REQUIRED. OpenID Connect requests MUST contain the "openid" scope value.
|
|
32
|
+
if (scopes.indexOf(oauth2_core_1.OidcScopes.OPENID) !== -1) {
|
|
33
|
+
// This is an OpenID Connect Authentication Request so return null
|
|
34
|
+
// and let OidcAuthorizationCodeAuthenticationProvider handle it instead
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
getUserinfo(clientRegistration, tokenResponse, additionalParameters) {
|
|
40
|
+
return this.userService.load({
|
|
41
|
+
clientRegistration,
|
|
42
|
+
accessToken: tokenResponse.accessToken,
|
|
43
|
+
additionalParameters
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async authenticate() {
|
|
47
|
+
if (!utils_1.AuthorizationResponseUtil.isAuthorizationResponse()) {
|
|
48
|
+
throw new oauth2_core_1.OAuth2AuthenticationError({
|
|
49
|
+
errorCode: oauth2_core_1.OAuth2ErrorCodes.INVALID_REQUEST
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const authorizationRequest = await this.authorizationRequestManager.get();
|
|
53
|
+
if (!authorizationRequest) {
|
|
54
|
+
throw new oauth2_core_1.OAuth2AuthenticationError({
|
|
55
|
+
errorCode: authentication_protocol_1.AUTHORIZATION_REQUEST_NOT_FOUND_ERROR_CODE
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (!this.checkScopes(authorizationRequest.scopes)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const registrationId = authorizationRequest.attributes[oauth2_core_1.OAuth2ParameterNames.REGISTRATION_ID];
|
|
62
|
+
const clientRegistration = await this.clientRegistrationManager.get(registrationId);
|
|
63
|
+
if (!clientRegistration) {
|
|
64
|
+
throw new oauth2_core_1.OAuth2AuthenticationError({
|
|
65
|
+
errorCode: authentication_protocol_1.CLIENT_REGISTRATION_NOT_FOUND_ERROR_CODE,
|
|
66
|
+
description: `Client Registration not found with Id: ${registrationId}`
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const redirectUri = await this.pathResolver.resolve(this.endpoint, node_1.Context.getRequest().path);
|
|
70
|
+
const authorizationResponse = utils_1.AuthorizationResponseUtil.convert(redirectUri);
|
|
71
|
+
if (authorizationResponse.error) {
|
|
72
|
+
throw new oauth2_core_1.OAuth2AuthenticationError(authorizationResponse.error);
|
|
73
|
+
}
|
|
74
|
+
if (authorizationResponse.state !== authorizationRequest.state) {
|
|
75
|
+
throw new oauth2_core_1.OAuth2AuthenticationError({
|
|
76
|
+
errorCode: authorization_1.INVALID_STATE_PARAMETER_ERROR_CODE
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
let tokenResponse;
|
|
80
|
+
try {
|
|
81
|
+
tokenResponse = await this.authorizationCodeTokenResponseClient.getTokenResponse({
|
|
82
|
+
authorizationGrantType: clientRegistration.authorizationGrantType,
|
|
83
|
+
clientRegistration,
|
|
84
|
+
authorizationExchange: {
|
|
85
|
+
authorizationRequest, authorizationResponse
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
if (error instanceof oauth2_core_1.OAuth2AuthorizationError) {
|
|
91
|
+
throw new oauth2_core_1.OAuth2AuthenticationError(error.oauth2Error);
|
|
92
|
+
}
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
const { additionalParameters } = tokenResponse;
|
|
96
|
+
const user = await this.getUserinfo(clientRegistration, tokenResponse, additionalParameters);
|
|
97
|
+
await this.userChecker.check(user);
|
|
98
|
+
await this.userMapper.map(user);
|
|
99
|
+
await this.authorizedClientManager.save({
|
|
100
|
+
clientRegistration,
|
|
101
|
+
accessToken: tokenResponse.accessToken,
|
|
102
|
+
refreshToken: tokenResponse.refreshToken,
|
|
103
|
+
principalName: user.username
|
|
104
|
+
}, user.username);
|
|
105
|
+
await this.authorizationRequestManager.remove();
|
|
106
|
+
return {
|
|
107
|
+
name: user.username,
|
|
108
|
+
principal: user,
|
|
109
|
+
credentials: '',
|
|
110
|
+
policies: user.policies,
|
|
111
|
+
clientRegistration,
|
|
112
|
+
authorizationExchange: { authorizationRequest, authorizationResponse },
|
|
113
|
+
accessToken: tokenResponse.accessToken,
|
|
114
|
+
refreshToken: tokenResponse.refreshToken,
|
|
115
|
+
authenticated: true
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
async support() {
|
|
119
|
+
return !!await this.requestMatcher.match(await this.pathResolver.resolve(this.options.redirectLoginPath));
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
__decorate([
|
|
123
|
+
(0, core_1.Value)('cell.oauth2.client'),
|
|
124
|
+
__metadata("design:type", Object)
|
|
125
|
+
], OAuth2AuthenticationProvider.prototype, "options", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, core_1.Autowired)(authorization_1.AuthorizationRequestManager),
|
|
128
|
+
__metadata("design:type", Object)
|
|
129
|
+
], OAuth2AuthenticationProvider.prototype, "authorizationRequestManager", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, core_1.Autowired)(registration_1.ClientRegistrationManager),
|
|
132
|
+
__metadata("design:type", Object)
|
|
133
|
+
], OAuth2AuthenticationProvider.prototype, "clientRegistrationManager", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, core_1.Autowired)(authorization_1.AuthorizedClientManager),
|
|
136
|
+
__metadata("design:type", Object)
|
|
137
|
+
], OAuth2AuthenticationProvider.prototype, "authorizedClientManager", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, core_1.Autowired)(user_1.OAuth2UserService),
|
|
140
|
+
__metadata("design:type", Object)
|
|
141
|
+
], OAuth2AuthenticationProvider.prototype, "userService", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, core_1.Autowired)(node_2.UserChecker),
|
|
144
|
+
__metadata("design:type", Object)
|
|
145
|
+
], OAuth2AuthenticationProvider.prototype, "userChecker", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, core_1.Autowired)(node_2.UserMapper),
|
|
148
|
+
__metadata("design:type", Object)
|
|
149
|
+
], OAuth2AuthenticationProvider.prototype, "userMapper", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, core_1.Autowired)(endpoint_1.AuthorizationCodeTokenResponseClient),
|
|
152
|
+
__metadata("design:type", endpoint_1.AuthorizationCodeTokenResponseClient)
|
|
153
|
+
], OAuth2AuthenticationProvider.prototype, "authorizationCodeTokenResponseClient", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, core_1.Autowired)(node_1.RequestMatcher),
|
|
156
|
+
__metadata("design:type", Object)
|
|
157
|
+
], OAuth2AuthenticationProvider.prototype, "requestMatcher", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, core_1.Autowired)(web_1.PathResolver),
|
|
160
|
+
__metadata("design:type", Object)
|
|
161
|
+
], OAuth2AuthenticationProvider.prototype, "pathResolver", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, core_1.Value)(web_1.ENDPOINT),
|
|
164
|
+
__metadata("design:type", String)
|
|
165
|
+
], OAuth2AuthenticationProvider.prototype, "endpoint", void 0);
|
|
166
|
+
OAuth2AuthenticationProvider = __decorate([
|
|
167
|
+
(0, core_1.Component)(node_2.AuthenticationProvider)
|
|
168
|
+
], OAuth2AuthenticationProvider);
|
|
169
|
+
exports.OAuth2AuthenticationProvider = OAuth2AuthenticationProvider;
|
|
170
|
+
//# sourceMappingURL=oauth2-authentication-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth2-authentication-provider.js","sourceRoot":"","sources":["../../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C,IAAA,gBAAS,EAAC,uCAAuB,CAAC;;6EACmD;AAEtF;IAAC,IAAA,gBAAS,EAAC,wBAAiB,CAAC;;iEACwC;AAErE;IAAC,IAAA,gBAAS,EAAC,kBAAW,CAAC;;iEACqB;AAE5C;IAAC,IAAA,gBAAS,EAAC,iBAAU,CAAC;;gEACoB;AAE1C;IAAC,IAAA,gBAAS,EAAC,+CAAoC,CAAC;8BACS,+CAAoC;0FAAC;AAE9F;IAAC,IAAA,gBAAS,EAAC,qBAAc,CAAC;;oEACwB;AAElD;IAAC,IAAA,gBAAS,EAAC,kBAAY,CAAC;;kEACsB;AAE9C;IAAC,IAAA,YAAK,EAAC,cAAQ,CAAC;;8DACoB;AAjC3B,4BAA4B;IADxC,IAAA,gBAAS,EAAC,6BAAsB,CAAC;GACrB,4BAA4B,CAiJxC;AAjJY,oEAA4B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AccessTokenResponse } from '@celljs/oauth2-core';
|
|
2
|
+
import { IdTokenJwtDecoderFactory, ClientRegistration } from '../registration';
|
|
3
|
+
import { Jwt } from '@celljs/oauth2-jose';
|
|
4
|
+
import { OidcUserRequest } from '../user';
|
|
5
|
+
import { UserService } from '@celljs/security/lib/node';
|
|
6
|
+
import { User } from '@celljs/security';
|
|
7
|
+
import { OAuth2AuthenticationProvider } from './oauth2-authentication-provider';
|
|
8
|
+
export declare class OidcAuthenticationProvider extends OAuth2AuthenticationProvider {
|
|
9
|
+
protected readonly idTokenJwtDecoderFactory: IdTokenJwtDecoderFactory;
|
|
10
|
+
protected readonly userService: UserService<OidcUserRequest, User>;
|
|
11
|
+
priority: number;
|
|
12
|
+
protected checkScopes(scopes: string[]): boolean;
|
|
13
|
+
protected getUserinfo(clientRegistration: ClientRegistration, tokenResponse: AccessTokenResponse, additionalParameters: {
|
|
14
|
+
[key: string]: string;
|
|
15
|
+
}): Promise<User>;
|
|
16
|
+
protected createOidcToken(clientRegistration: ClientRegistration, tokenResponse: AccessTokenResponse): Promise<Jwt>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=oidc-authentication-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oidc-authentication-provider.d.ts","sourceRoot":"","sources":["../../../src/node/authentication/oidc-authentication-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAyC,mBAAmB,EAAqB,MAAM,qBAAqB,CAAC;AACpH,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAmB,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,WAAW,EAA0B,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAEhF,qBACa,0BAA2B,SAAQ,4BAA4B;IAGxE,SAAS,CAAC,QAAQ,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;IAEtE,mBAC4B,WAAW,EAAE,WAAW,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;IAEnE,QAAQ,SAAyC;cAEvC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE;cAYtB,WAAW,CAAC,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,mBAAmB,EAAE,oBAAoB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE;cAWhJ,eAAe,CAAC,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC;CAc5H"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OidcAuthenticationProvider = void 0;
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
const oauth2_core_1 = require("@celljs/oauth2-core");
|
|
15
|
+
const registration_1 = require("../registration");
|
|
16
|
+
const jose_1 = require("jose");
|
|
17
|
+
const user_1 = require("../user");
|
|
18
|
+
const node_1 = require("@celljs/security/lib/node");
|
|
19
|
+
const authentication_protocol_1 = require("./authentication-protocol");
|
|
20
|
+
const oauth2_authentication_provider_1 = require("./oauth2-authentication-provider");
|
|
21
|
+
let OidcAuthenticationProvider = class OidcAuthenticationProvider extends oauth2_authentication_provider_1.OAuth2AuthenticationProvider {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.priority = authentication_protocol_1.OIDC_AUTHENTICATION_PROVIDER_PRIORITY;
|
|
25
|
+
}
|
|
26
|
+
checkScopes(scopes) {
|
|
27
|
+
// Section 3.1.2.1 Authentication Request - https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
|
|
28
|
+
// scope
|
|
29
|
+
// REQUIRED. OpenID Connect requests MUST contain the "openid" scope value.
|
|
30
|
+
if (scopes.indexOf(oauth2_core_1.OidcScopes.OPENID) === -1) {
|
|
31
|
+
// This is NOT an OpenID Connect Authentication Request so return undefined
|
|
32
|
+
// and let OAuth2AuthenticationProvider handle it instead
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
async getUserinfo(clientRegistration, tokenResponse, additionalParameters) {
|
|
38
|
+
const idToken = await this.createOidcToken(clientRegistration, tokenResponse);
|
|
39
|
+
return this.userService.load({
|
|
40
|
+
idToken,
|
|
41
|
+
clientRegistration,
|
|
42
|
+
accessToken: tokenResponse.accessToken,
|
|
43
|
+
additionalParameters
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async createOidcToken(clientRegistration, tokenResponse) {
|
|
47
|
+
const jwtDecoder = await this.idTokenJwtDecoderFactory.create(clientRegistration);
|
|
48
|
+
try {
|
|
49
|
+
return jwtDecoder.decode(tokenResponse.additionalParameters[oauth2_core_1.OidcParameterNames.ID_TOKEN]);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (error instanceof jose_1.errors.JOSEError) {
|
|
53
|
+
throw new oauth2_core_1.OAuth2AuthenticationError({
|
|
54
|
+
errorCode: authentication_protocol_1.INVALID_ID_TOKEN_ERROR_CODE,
|
|
55
|
+
description: error.message
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, core_1.Autowired)(registration_1.IdTokenJwtDecoderFactory),
|
|
64
|
+
__metadata("design:type", registration_1.IdTokenJwtDecoderFactory)
|
|
65
|
+
], OidcAuthenticationProvider.prototype, "idTokenJwtDecoderFactory", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, core_1.Autowired)(user_1.OidcUserService),
|
|
68
|
+
__metadata("design:type", Object)
|
|
69
|
+
], OidcAuthenticationProvider.prototype, "userService", void 0);
|
|
70
|
+
OidcAuthenticationProvider = __decorate([
|
|
71
|
+
(0, core_1.Component)(node_1.AuthenticationProvider)
|
|
72
|
+
], OidcAuthenticationProvider);
|
|
73
|
+
exports.OidcAuthenticationProvider = OidcAuthenticationProvider;
|
|
74
|
+
//# sourceMappingURL=oidc-authentication-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oidc-authentication-provider.js","sourceRoot":"","sources":["../../../src/node/authentication/oidc-authentication-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAoD;AACpD,qDAAoH;AACpH,kDAA+E;AAE/E,+BAA8B;AAC9B,kCAA2D;AAC3D,oDAAgF;AAEhF,uEAA+G;AAC/G,qFAAgF;AAGzE,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,6DAA4B;IAArE;;QAQM,aAAQ,GAAG,+DAAqC,CAAC;IAuC9D,CAAC;IArCsB,WAAW,CAAC,MAAgB;QAC3C,6GAA6G;QAC7G,QAAQ;QACR,mFAAmF;QACnF,IAAI,MAAM,CAAC,OAAO,CAAC,wBAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;YAC1C,2EAA2E;YAC3E,yDAAyD;YACzD,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEkB,KAAK,CAAC,WAAW,CAAC,kBAAsC,EAAE,aAAkC,EAAE,oBAA+C;QAC5J,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;QAE9E,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;YACzB,OAAO;YACP,kBAAkB;YAClB,WAAW,EAAE,aAAa,CAAC,WAAW;YACtC,oBAAoB;SACvB,CAAC,CAAC;IACP,CAAC;IAES,KAAK,CAAC,eAAe,CAAC,kBAAsC,EAAE,aAAkC;QACtG,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAClF,IAAI;YACA,OAAO,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,oBAAoB,CAAC,gCAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;SAC7F;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,KAAK,YAAY,aAAM,CAAC,SAAS,EAAE;gBACnC,MAAM,IAAI,uCAAyB,CAAC;oBAChC,SAAS,EAAE,qDAA2B;oBACtC,WAAW,EAAE,KAAK,CAAC,OAAO;iBAC7B,CAAC,CAAC;aACN;YACD,MAAM,KAAK,CAAC;SACf;IACL,CAAC;CACJ,CAAA;AA7CG;IAAC,IAAA,gBAAS,EAAC,uCAAwB,CAAC;8BACS,uCAAwB;4EAAC;AAEtE;IAAC,IAAA,gBAAS,EAAC,sBAAe,CAAC;;+DACiD;AANnE,0BAA0B;IADtC,IAAA,gBAAS,EAAC,6BAAsB,CAAC;GACrB,0BAA0B,CA+CtC;AA/CY,gEAA0B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AuthorizedClientProvider, AuthorizationContext, AuthorizedClient } from './authorization-protocol';
|
|
2
|
+
export declare class AuthorizationCodeAuthorizedClientProvider implements AuthorizedClientProvider {
|
|
3
|
+
provide(context: AuthorizationContext): Promise<AuthorizedClient | undefined>;
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=authorization-code-authorized-client-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-code-authorized-client-provider.d.ts","sourceRoot":"","sources":["../../../src/node/authorization/authorization-code-authorized-client-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAK5G,qBACa,yCAA0C,YAAW,wBAAwB;IAChF,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;CAQtF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AuthorizationCodeAuthorizedClientProvider = void 0;
|
|
10
|
+
const authorization_protocol_1 = require("./authorization-protocol");
|
|
11
|
+
const oauth2_core_1 = require("@celljs/oauth2-core");
|
|
12
|
+
const error_1 = require("../error");
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
let AuthorizationCodeAuthorizedClientProvider = class AuthorizationCodeAuthorizedClientProvider {
|
|
15
|
+
async provide(context) {
|
|
16
|
+
const { clientRegistration, authorizedClient } = context;
|
|
17
|
+
if (oauth2_core_1.AuthorizationGrantType.AuthorizationCode === clientRegistration.authorizationGrantType && !authorizedClient) {
|
|
18
|
+
throw new error_1.ClientAuthorizationRequiredError(clientRegistration.registrationId);
|
|
19
|
+
}
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
AuthorizationCodeAuthorizedClientProvider = __decorate([
|
|
24
|
+
(0, core_1.Component)(authorization_protocol_1.AuthorizedClientProvider)
|
|
25
|
+
], AuthorizationCodeAuthorizedClientProvider);
|
|
26
|
+
exports.AuthorizationCodeAuthorizedClientProvider = AuthorizationCodeAuthorizedClientProvider;
|
|
27
|
+
//# sourceMappingURL=authorization-code-authorized-client-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-code-authorized-client-provider.js","sourceRoot":"","sources":["../../../src/node/authorization/authorization-code-authorized-client-provider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,qEAA4G;AAC5G,qDAA6D;AAC7D,oCAA4D;AAC5D,uCAAyC;AAGlC,IAAM,yCAAyC,GAA/C,MAAM,yCAAyC;IAClD,KAAK,CAAC,OAAO,CAAC,OAA6B;QACvC,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;QACzD,IAAI,oCAAsB,CAAC,iBAAiB,KAAK,kBAAkB,CAAC,sBAAsB,IAAI,CAAC,gBAAgB,EAAE;YAC7G,MAAM,IAAI,wCAAgC,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;SACjF;QACD,OAAO;IACX,CAAC;CAEJ,CAAA;AATY,yCAAyC;IADrD,IAAA,gBAAS,EAAC,iDAAwB,CAAC;GACvB,yCAAyC,CASrD;AATY,8FAAyC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Middleware, Context, RedirectStrategy, RequestMatcher } from '@celljs/web/lib/node';
|
|
2
|
+
import { AuthorizationRequestResolver, AuthorizationRequestManager, AuthorizedClientManager, AuthorizedClient } from './authorization-protocol';
|
|
3
|
+
import { AuthorizationRequest } from '@celljs/oauth2-core';
|
|
4
|
+
import { ClientRegistrationManager } from '../registration';
|
|
5
|
+
import { PathResolver } from '@celljs/web';
|
|
6
|
+
import { RequestCache } from '@celljs/security/lib/node';
|
|
7
|
+
import { AuthorizationCodeTokenResponseClient } from '../endpoint';
|
|
8
|
+
export declare class AuthorizationCodeGrantMiddleware implements Middleware {
|
|
9
|
+
protected readonly authorizationRequestManager: AuthorizationRequestManager<AuthorizationRequest>;
|
|
10
|
+
protected readonly authorizationRequestResolver: AuthorizationRequestResolver;
|
|
11
|
+
protected readonly clientRegistrationManager: ClientRegistrationManager;
|
|
12
|
+
protected readonly authorizedClientManager: AuthorizedClientManager<AuthorizedClient>;
|
|
13
|
+
protected readonly redirectStrategy: RedirectStrategy;
|
|
14
|
+
protected readonly requestMatcher: RequestMatcher;
|
|
15
|
+
protected readonly pathResolver: PathResolver;
|
|
16
|
+
protected readonly requestCache: RequestCache;
|
|
17
|
+
protected readonly authorizationCodeTokenResponseClient: AuthorizationCodeTokenResponseClient;
|
|
18
|
+
protected readonly endpoint: string;
|
|
19
|
+
protected readonly redirectLoginPath: string;
|
|
20
|
+
protected readonly authorizationCodeGrantUri: string;
|
|
21
|
+
handle(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
22
|
+
processAuthorizationResponse(): Promise<void>;
|
|
23
|
+
protected matchesAuthorizationResponse(): Promise<boolean>;
|
|
24
|
+
readonly priority: number;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=authorization-code-grant-middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-code-grant-middleware.d.ts","sourceRoot":"","sources":["../../../src/node/authorization/authorization-code-grant-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE7F,OAAO,EAAE,4BAA4B,EAAE,2BAA2B,EAC9D,uBAAuB,EAAE,gBAAgB,EAAsC,MAAM,0BAA0B,CAAC;AACpH,OAAO,EAAE,oBAAoB,EAA+D,MAAM,qBAAqB,CAAC;AAExH,OAAO,EAAE,yBAAyB,EAAsB,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAY,YAAY,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAmB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,oCAAoC,EAAE,MAAM,aAAa,CAAC;AAGnE,qBACa,gCAAiC,YAAW,UAAU;IAG/D,SAAS,CAAC,QAAQ,CAAC,2BAA2B,EAAE,2BAA2B,CAAC,oBAAoB,CAAC,CAAC;IAGlG,SAAS,CAAC,QAAQ,CAAC,4BAA4B,EAAE,4BAA4B,CAAC;IAG9E,SAAS,CAAC,QAAQ,CAAC,yBAAyB,EAAE,yBAAyB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