UNPKG

oidc-client-rx

Version:

ReactiveX enhanced OIDC and OAuth2 protocol support for browser-based JavaScript applications

43 lines (42 loc) 4.68 kB
import { Injectable, inject } from "injection-js"; import { concatMap } from "rxjs/operators"; import { CodeFlowCallbackHandlerService } from "./callback-handling/code-flow-callback-handler.service.js"; import { HistoryJwtKeysCallbackHandlerService } from "./callback-handling/history-jwt-keys-callback-handler.service.js"; import { ImplicitFlowCallbackHandlerService } from "./callback-handling/implicit-flow-callback-handler.service.js"; import { RefreshSessionCallbackHandlerService } from "./callback-handling/refresh-session-callback-handler.service.js"; import { RefreshTokenCallbackHandlerService } from "./callback-handling/refresh-token-callback-handler.service.js"; import { StateValidationCallbackHandlerService } from "./callback-handling/state-validation-callback-handler.service.js"; import { UserCallbackHandlerService } from "./callback-handling/user-callback-handler.service.js"; function _ts_decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; } class FlowsService { processCodeFlowCallback(urlToCheck, config, allConfigs) { return this.codeFlowCallbackHandlerService.codeFlowCallback(urlToCheck, config).pipe(concatMap((callbackContext)=>this.codeFlowCallbackHandlerService.codeFlowCodeRequest(callbackContext, config)), concatMap((callbackContext)=>this.historyJwtKeysCallbackHandlerService.callbackHistoryAndResetJwtKeys(callbackContext, config, allConfigs)), concatMap((callbackContext)=>this.stateValidationCallbackHandlerService.callbackStateValidation(callbackContext, config, allConfigs)), concatMap((callbackContext)=>this.userHandlerService.callbackUser(callbackContext, config, allConfigs))); } processSilentRenewCodeFlowCallback(firstContext, config, allConfigs) { return this.codeFlowCallbackHandlerService.codeFlowCodeRequest(firstContext, config).pipe(concatMap((callbackContext)=>this.historyJwtKeysCallbackHandlerService.callbackHistoryAndResetJwtKeys(callbackContext, config, allConfigs)), concatMap((callbackContext)=>this.stateValidationCallbackHandlerService.callbackStateValidation(callbackContext, config, allConfigs)), concatMap((callbackContext)=>this.userHandlerService.callbackUser(callbackContext, config, allConfigs))); } processImplicitFlowCallback(config, allConfigs, hash) { return this.implicitFlowCallbackHandlerService.implicitFlowCallback(config, allConfigs, hash).pipe(concatMap((callbackContext)=>this.historyJwtKeysCallbackHandlerService.callbackHistoryAndResetJwtKeys(callbackContext, config, allConfigs)), concatMap((callbackContext)=>this.stateValidationCallbackHandlerService.callbackStateValidation(callbackContext, config, allConfigs)), concatMap((callbackContext)=>this.userHandlerService.callbackUser(callbackContext, config, allConfigs))); } processRefreshToken(config, allConfigs, customParamsRefresh) { return this.refreshSessionCallbackHandlerService.refreshSessionWithRefreshTokens(config).pipe(concatMap((callbackContext)=>this.refreshTokenCallbackHandlerService.refreshTokensRequestTokens(callbackContext, config, customParamsRefresh)), concatMap((callbackContext)=>this.historyJwtKeysCallbackHandlerService.callbackHistoryAndResetJwtKeys(callbackContext, config, allConfigs)), concatMap((callbackContext)=>this.stateValidationCallbackHandlerService.callbackStateValidation(callbackContext, config, allConfigs)), concatMap((callbackContext)=>this.userHandlerService.callbackUser(callbackContext, config, allConfigs))); } constructor(){ this.codeFlowCallbackHandlerService = inject(CodeFlowCallbackHandlerService); this.implicitFlowCallbackHandlerService = inject(ImplicitFlowCallbackHandlerService); this.historyJwtKeysCallbackHandlerService = inject(HistoryJwtKeysCallbackHandlerService); this.userHandlerService = inject(UserCallbackHandlerService); this.stateValidationCallbackHandlerService = inject(StateValidationCallbackHandlerService); this.refreshSessionCallbackHandlerService = inject(RefreshSessionCallbackHandlerService); this.refreshTokenCallbackHandlerService = inject(RefreshTokenCallbackHandlerService); } } FlowsService = _ts_decorate([ Injectable() ], FlowsService); export { FlowsService };