11'use strict'
2+ /* eslint-disable node/no-deprecated-api */
23
34const AuthResponseSent = require ( '../errors/auth-response-sent' )
45const url = require ( 'url' )
@@ -17,12 +18,12 @@ class LoginConsentRequest {
1718 * @return {Promise<OPAuthenticationRequest> }
1819 */
1920 static handle ( opAuthRequest , skipConsent = false ) {
20- let notLoggedIn = ! opAuthRequest . subject
21+ const notLoggedIn = ! opAuthRequest . subject
2122 if ( notLoggedIn ) {
2223 return Promise . resolve ( opAuthRequest ) // pass through
2324 }
2425
25- let consentRequest = LoginConsentRequest . from ( opAuthRequest )
26+ const consentRequest = LoginConsentRequest . from ( opAuthRequest )
2627
2728 if ( skipConsent ) {
2829 consentRequest . markConsentSuccess ( opAuthRequest )
@@ -38,9 +39,9 @@ class LoginConsentRequest {
3839 * @return {LoginConsentRequest }
3940 */
4041 static from ( opAuthRequest ) {
41- let params = LoginConsentRequest . extractParams ( opAuthRequest )
42+ const params = LoginConsentRequest . extractParams ( opAuthRequest )
4243
43- let options = {
44+ const options = {
4445 opAuthRequest,
4546 params,
4647 response : opAuthRequest . res
@@ -50,10 +51,10 @@ class LoginConsentRequest {
5051 }
5152
5253 static extractParams ( opAuthRequest ) {
53- let req = opAuthRequest . req
54- let query = req . query || { }
55- let body = req . body || { }
56- let params = query [ ' client_id' ] ? query : body
54+ const req = opAuthRequest . req
55+ const query = req . query || { }
56+ const body = req . body || { }
57+ const params = query . client_id ? query : body
5758 return params
5859 }
5960
@@ -63,7 +64,7 @@ class LoginConsentRequest {
6364 * @return {Promise<OPAuthenticationRequest> }
6465 */
6566 static obtainConsent ( consentRequest ) {
66- let { opAuthRequest, clientId } = consentRequest
67+ const { opAuthRequest, clientId } = consentRequest
6768
6869 const parsedAppOrigin = url . parse ( consentRequest . opAuthRequest . params . redirect_uri )
6970 const appOrigin = `${ parsedAppOrigin . protocol } //${ parsedAppOrigin . host } `
@@ -98,7 +99,7 @@ class LoginConsentRequest {
9899 * @return {string }
99100 */
100101 get clientId ( ) {
101- return this . params [ ' client_id' ]
102+ return this . params . client_id
102103 }
103104
104105 isLocalRpClient ( appOrigin ) {
@@ -124,7 +125,7 @@ class LoginConsentRequest {
124125 }
125126
126127 redirectToConsent ( authRequest ) {
127- let { opAuthRequest } = this
128+ const { opAuthRequest } = this
128129 let consentUrl = url . parse ( '/sharing' )
129130 consentUrl . query = opAuthRequest . req . query
130131
0 commit comments