MCPcopy Create free account
hub / github.com/dataease/SQLBot / oauth2_authorize_authorize

Function oauth2_authorize_authorize

frontend/public/swagger-ui-bundle.js:59312–59393  ·  view source on GitHub ↗
({
          auth: s,
          authActions: o,
          errActions: i,
          configs: a,
          authConfigs: u = {},
          currentServer: _,
        })

Source from the content-addressed store, hash-verified

59310 })
59311 }
59312 }
59313 function oauth2_authorize_authorize({
59314 auth: s,
59315 authActions: o,
59316 errActions: i,
59317 configs: a,
59318 authConfigs: u = {},
59319 currentServer: _,
59320 }) {
59321 let { schema: w, scopes: x, name: C, clientId: j } = s,
59322 L = w.get('flow'),
59323 B = []
59324 switch (L) {
59325 case 'password':
59326 return void o.authorizePassword(s)
59327 case 'application':
59328 case 'clientCredentials':
59329 case 'client_credentials':
59330 return void o.authorizeApplication(s)
59331 case 'accessCode':
59332 case 'authorizationCode':
59333 case 'authorization_code':
59334 B.push('response_type=code')
59335 break
59336 case 'implicit':
59337 B.push('response_type=token')
59338 }
59339 'string' == typeof j && B.push('client_id=' + encodeURIComponent(j))
59340 let $ = a.oauth2RedirectUrl
59341 if (void 0 === $)
59342 return void i.newAuthErr({
59343 authId: C,
59344 source: 'validation',
59345 level: 'error',
59346 message:
59347 'oauth2RedirectUrl configuration is not passed. Oauth2 authorization cannot be performed.',
59348 })
59349 B.push('redirect_uri=' + encodeURIComponent($))
59350 let U = []
59351 if (
59352 (Array.isArray(x) ? (U = x) : We().List.isList(x) && (U = x.toArray()), U.length > 0)
59353 ) {
59354 let s = u.scopeSeparator || ' '
59355 B.push('scope=' + encodeURIComponent(U.join(s)))
59356 }
59357 let V = utils_btoa(new Date())
59358 if (
59359 (B.push('state=' + encodeURIComponent(V)),
59360 void 0 !== u.realm && B.push('realm=' + encodeURIComponent(u.realm)),
59361 ('authorizationCode' === L || 'authorization_code' === L || 'accessCode' === L) &&
59362 u.usePkceWithAuthorizationCodeGrant)
59363 ) {
59364 const o = (function generateCodeVerifier() {
59365 return b64toB64UrlEncoded(xt()(32).toString('base64'))
59366 })(),
59367 i = (function createCodeChallenge(s) {
59368 return b64toB64UrlEncoded(Ot()('sha256').update(s).digest('base64'))
59369 })(o)

Callers 1

Oauth2Class · 0.85

Calls 14

utils_btoaFunction · 0.85
b64toB64UrlEncodedFunction · 0.85
OtFunction · 0.85
sanitizeUrlFunction · 0.85
getMethod · 0.65
WeFunction · 0.50
xtFunction · 0.50
NtFunction · 0.50
pushMethod · 0.45
isArrayMethod · 0.45
toArrayMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected