6
6
* @copyright (c) 2019 Passbolt SA
7
7
* @licence GNU Affero General Public License http://www.gnu.org/licenses/agpl-3.0.en.html
8
8
*/
9
- const AuthController = require ( '../controller/authController' ) . AuthController ;
10
- const AuthCheckStatusController = require ( '../controller/auth/authCheckStatusController' ) . AuthCheckStatusController ;
11
- const AuthIsAuthenticatedController = require ( '../controller/auth/authIsAuthenticatedController' ) . AuthIsAuthenticatedController ;
12
- const AuthIsMfaRequiredController = require ( '../controller/auth/authIsMfaRequiredController' ) . AuthIsMfaRequiredController ;
13
- const GpgAuth = require ( '../model/gpgauth' ) . GpgAuth ;
9
+ const { AuthController} = require ( '../controller/authController' ) ;
10
+ const { AuthCheckStatusController} = require ( '../controller/auth/authCheckStatusController' ) ;
11
+ const { AuthIsAuthenticatedController} = require ( '../controller/auth/authIsAuthenticatedController' ) ;
12
+ const { AuthIsMfaRequiredController} = require ( '../controller/auth/authIsMfaRequiredController' ) ;
13
+ const { AuthUpdateServerKeyController} = require ( '../controller/auth/authUpdateServerKeyController' ) ;
14
+ const { GpgAuth} = require ( '../model/gpgauth' ) ;
14
15
const Worker = require ( '../model/worker' ) ;
15
16
16
17
const listen = function ( worker ) {
17
-
18
18
/*
19
19
* Check if the user is authenticated.
20
20
*
@@ -79,11 +79,11 @@ const listen = function (worker) {
79
79
/*
80
80
* Get the password server key for a given domain.
81
81
*
82
- * @listens passbolt.auth.getServerKey
82
+ * @listens passbolt.auth.get-server-key
83
83
* @param requestId {uuid} The request identifier
84
84
* @param domain {string} The server's domain
85
85
*/
86
- worker . port . on ( 'passbolt.auth.getServerKey ' , function ( requestId , domain ) {
86
+ worker . port . on ( 'passbolt.auth.get-server-key ' , function ( requestId , domain ) {
87
87
var gpgauth = new GpgAuth ( ) ;
88
88
gpgauth . getServerKey ( domain ) . then (
89
89
function success ( msg ) {
@@ -95,6 +95,17 @@ const listen = function (worker) {
95
95
) ;
96
96
} ) ;
97
97
98
+ /*
99
+ * Get the password server key for a given domain.
100
+ *
101
+ * @listens passbolt.auth.replace-server-key
102
+ * @param requestId {uuid} The request identifier
103
+ */
104
+ worker . port . on ( 'passbolt.auth.replace-server-key' , async function ( requestId ) {
105
+ const controller = new AuthUpdateServerKeyController ( worker , requestId ) ;
106
+ await controller . main ( ) ;
107
+ } ) ;
108
+
98
109
/*
99
110
* Attempt to login the current user.
100
111
*
@@ -108,7 +119,7 @@ const listen = function (worker) {
108
119
* @param redirect {string} The uri to redirect the user after login
109
120
*/
110
121
worker . port . on ( 'passbolt.auth.login' , function ( requestId , passphrase , remember , redirect ) {
111
- var auth = new AuthController ( worker , requestId ) ;
122
+ const auth = new AuthController ( worker , requestId ) ;
112
123
auth . login ( passphrase , remember , redirect ) ;
113
124
} ) ;
114
125
0 commit comments