{"version":3,"file":"formioangular-colfuturo-auth.mjs","sources":["../../../projects/angular-formio/auth/src/auth.config.ts","../../../projects/angular-formio/auth/src/auth.service.ts","../../../projects/angular-formio/auth/src/auth.component.ts","../../../projects/angular-formio/auth/src/auth.component.html","../../../projects/angular-formio/auth/src/login/login.component.ts","../../../projects/angular-formio/auth/src/login/login.component.html","../../../projects/angular-formio/auth/src/register/register.component.ts","../../../projects/angular-formio/auth/src/register/register.component.html","../../../projects/angular-formio/auth/src/resetpass/resetpass.component.ts","../../../projects/angular-formio/auth/src/resetpass/resetpass.component.html","../../../projects/angular-formio/auth/src/auth.routes.ts","../../../projects/angular-formio/auth/src/auth.module.ts","../../../projects/angular-formio/auth/src/formioangular-colfuturo-auth.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\n\r\nexport interface FormioAuthFormConfig {\r\n  path?: string;\r\n  form?: string;\r\n  component?: any;\r\n}\r\n\r\nexport interface FormioAuthRouteConfig {\r\n  auth?: any;\r\n  login?: any;\r\n  register?: any;\r\n  resetpass?: any;\r\n}\r\n\r\n@Injectable()\r\nexport class FormioAuthConfig {\r\n  component?: any;\r\n  delayAuth?: any;\r\n  login?: FormioAuthFormConfig;\r\n  register?: FormioAuthFormConfig;\r\n  resetpass?: FormioAuthFormConfig;\r\n  oauth?: FormioOAuthConfig;\r\n}\r\n\r\n\r\nexport interface FormioOAuthConfig {\r\n  type: FormioOauthType;\r\n  options: FormioOktaConfig | FormioSamlConfig;\r\n}\r\n\r\nexport enum FormioOauthType {\r\n  okta = 'okta',\r\n  saml = 'saml',\r\n}\r\n\r\nexport interface FormioOktaConfig extends OktaConfig {\r\n  formio?: any;\r\n}\r\n\r\nexport interface FormioSamlConfig {\r\n  relay: string;\r\n}\r\n\r\n// for more details about Okta configuration options see https://github.com/okta/okta-auth-js#configuration-reference\r\nexport interface OktaConfig {\r\n  url?: string;\r\n  tokenManager?: OktaTokenManagerConfig;\r\n  issuer?: string;\r\n  clientId?: string;\r\n  redirectUri?: string;\r\n  postLogoutRedirectUri?: string;\r\n  pkce?: boolean;\r\n  authorizeUrl?: string;\r\n  userinfoUrl?: string;\r\n  tokenUrl?: string;\r\n  ignoreSignature?: boolean;\r\n  maxClockSkew?: number;\r\n  scopes?: string[];\r\n  httpRequestClient?: Function;\r\n}\r\n\r\nexport interface OktaTokenManagerConfig {\r\n  storage?: string | {\r\n    getItem?: Function;\r\n    setItem?: Function;\r\n  };\r\n  secure?: boolean;\r\n  autoRenew?: boolean;\r\n  expireEarlySeconds?: number;\r\n  storageKey?: string;\r\n}\r\n","import { EventEmitter, Injectable, Inject } from \"@angular/core\";\r\nimport { FormioAuthConfig } from \"./auth.config\";\r\nimport { FormioAppConfig } from \"formioangular-colfuturo\";\r\nimport { get, each } from \"lodash\";\r\nimport { Formio } from \"formiojs-colfuturo\";\r\n\r\n@Injectable()\r\nexport class FormioAuthService {\r\n  public user: any;\r\n  public authenticated = false;\r\n\r\n  public loginForm: string;\r\n  public onLogin: EventEmitter<object>;\r\n  public onLogout: EventEmitter<object>;\r\n\r\n  public registerForm: string;\r\n  public onRegister: EventEmitter<object>;\r\n  public onUser: EventEmitter<object>;\r\n  public onError: EventEmitter<any>;\r\n\r\n  public resetPassForm: string;\r\n  public onResetPass: EventEmitter<object>;\r\n\r\n  public ready: Promise<boolean>;\r\n  public readyResolve: any;\r\n  public readyReject: any;\r\n\r\n  public projectReady?: Promise<any>;\r\n  public accessReady?: Promise<any>;\r\n  public userReady?: Promise<any>;\r\n  public formAccess: any = {};\r\n  public submissionAccess: any = {};\r\n  public roles: any;\r\n  public is: any = {};\r\n\r\n  constructor(\r\n    public appConfig: FormioAppConfig,\r\n    public config: FormioAuthConfig\r\n  ) {\r\n    this.user = null;\r\n\r\n    if (this.appConfig && this.appConfig.appUrl) {\r\n      Formio.setBaseUrl(this.appConfig.apiUrl);\r\n      Formio.setProjectUrl(this.appConfig.appUrl);\r\n      Formio.formOnly = !!this.appConfig.formOnly;\r\n    } else {\r\n      console.error(\"You must provide an AppConfig within your application!\");\r\n    }\r\n\r\n    this.loginForm =\r\n      this.appConfig.appUrl +\r\n      \"/\" +\r\n      get(this.config, \"login.form\", \"user/login\");\r\n    this.registerForm =\r\n      this.appConfig.appUrl +\r\n      \"/\" +\r\n      get(this.config, \"register.form\", \"user/register\");\r\n    this.resetPassForm =\r\n      this.appConfig.appUrl +\r\n      \"/\" +\r\n      get(this.config, \"resetpass.form\", \"resetpass\");\r\n    this.onLogin = new EventEmitter();\r\n    this.onLogout = new EventEmitter();\r\n    this.onRegister = new EventEmitter();\r\n    this.onUser = new EventEmitter();\r\n    this.onError = new EventEmitter();\r\n\r\n    this.ready = new Promise((resolve: any, reject: any) => {\r\n      this.readyResolve = resolve;\r\n      this.readyReject = reject;\r\n    });\r\n\r\n    // Register for the core events.\r\n    Formio.events.on(\"formio.badToken\", () => this.logoutError());\r\n    Formio.events.on(\"formio.sessionExpired\", () => this.logoutError());\r\n    if (!this.config.delayAuth) {\r\n      this.init();\r\n    }\r\n  }\r\n\r\n  onLoginSubmit(submission: object) {\r\n    this.setUser(submission);\r\n    this.onLogin.emit(submission);\r\n  }\r\n\r\n  onRegisterSubmit(submission: object) {\r\n    this.setUser(submission);\r\n    this.onRegister.emit(submission);\r\n  }\r\n\r\n  onResetPassSubmit(submission: object) {\r\n    this.onResetPass.emit(submission);\r\n  }\r\n\r\n  init() {\r\n    this.projectReady = Formio.makeStaticRequest(this.appConfig.appUrl).then(\r\n      (project: any) => {\r\n        each(project.access, (access: any) => {\r\n          this.formAccess[access.type] = access.roles;\r\n        });\r\n      },\r\n      (): any => {\r\n        this.formAccess = {};\r\n        return null;\r\n      }\r\n    );\r\n\r\n    // Get the access for this project.\r\n    this.accessReady = Formio.makeStaticRequest(\r\n      this.appConfig.appUrl + \"/access\"\r\n    )\r\n      .then((access: any) => {\r\n        each(access.forms, (form: any) => {\r\n          this.submissionAccess[form.name] = {};\r\n          form.submissionAccess.forEach((subAccess: any) => {\r\n            this.submissionAccess[form.name][subAccess.type] = subAccess.roles;\r\n          });\r\n        });\r\n        this.roles = access.roles;\r\n        return access;\r\n      })\r\n      .catch((err): any => {\r\n        if (err === \"Token Expired\" || err === \"Bad Token\") {\r\n          this.setUser(null);\r\n        }\r\n        this.roles = {};\r\n        return null;\r\n      });\r\n\r\n    let currentUserPromise: Promise<any>;\r\n    if (this.config.oauth) {\r\n      // Make a fix to the hash to remove starting \"/\" that angular might put there.\r\n      if (\r\n        window.location.hash &&\r\n        window.location.hash.match(/^#\\/access_token/)\r\n      ) {\r\n        history.pushState(\r\n          null,\r\n          null,\r\n          window.location.hash.replace(/^#\\/access_token/, \"#access_token\")\r\n        );\r\n      }\r\n\r\n      // Initiate the SSO if they provide oauth settings.\r\n      currentUserPromise = Formio.ssoInit(\r\n        this.config.oauth.type,\r\n        this.config.oauth.options\r\n      );\r\n    } else {\r\n      currentUserPromise = Formio.currentUser(null, {\r\n        ignoreCache: true,\r\n      });\r\n    }\r\n\r\n    this.userReady = currentUserPromise\r\n      .then((user: any) => {\r\n        this.setUser(user);\r\n        return user;\r\n      })\r\n      .catch((err) => {\r\n        this.setUser(null);\r\n        throw err;\r\n      });\r\n\r\n    // Trigger we are redy when all promises have resolved.\r\n    if (this.accessReady) {\r\n      this.accessReady\r\n        .then(() => this.projectReady)\r\n        .then(() => this.userReady)\r\n        .then(() => this.readyResolve(true))\r\n        .catch((err: any) => this.readyReject(err));\r\n    }\r\n  }\r\n\r\n  setUser(user: any) {\r\n    const namespace = Formio.namespace || \"formio\";\r\n    if (user) {\r\n      this.user = user;\r\n      localStorage.setItem(`${namespace}AppUser`, JSON.stringify(user));\r\n      this.setUserRoles();\r\n      Formio.setUser(user);\r\n    } else {\r\n      this.user = null;\r\n      this.is = {};\r\n      localStorage.removeItem(`${namespace}AppUser`);\r\n      Formio.clearCache();\r\n      Formio.setUser(null);\r\n    }\r\n\r\n    this.authenticated = !!Formio.getToken();\r\n    this.onUser.emit(this.user);\r\n  }\r\n\r\n  setUserRoles() {\r\n    if (this.accessReady) {\r\n      this.accessReady.then(() => {\r\n        each(this.roles, (role: any, roleName: string) => {\r\n          if (this.user.roles.indexOf(role._id) !== -1) {\r\n            this.is[roleName] = true;\r\n          }\r\n        });\r\n      });\r\n    }\r\n  }\r\n\r\n  logoutError() {\r\n    this.setUser(null);\r\n    const namespace = Formio.namespace || \"formio\";\r\n    localStorage.removeItem(`${namespace}Token`);\r\n    this.onError.emit();\r\n  }\r\n\r\n  logout() {\r\n    const namespace = Formio.namespace || \"formio\";\r\n    const tokenName = `${namespace}Token`;\r\n\r\n    localStorage.removeItem(tokenName);\r\n    if (\r\n      (Formio as any).tokens &&\r\n      (Formio as any).tokens.hasOwnProperty(tokenName)\r\n    ) {\r\n      delete (Formio as any).tokens[tokenName];\r\n    }\r\n\r\n    Formio.logout()\r\n      .then(() => {\r\n        this.setUser(null);\r\n        if (localStorage.getItem(`${namespace}LogoutAuthUrl`)) {\r\n          window.open(\r\n            localStorage.getItem(`${namespace}LogoutAuthUrl`),\r\n            null,\r\n            \"width=1020,height=618\"\r\n          );\r\n          localStorage.removeItem(`${namespace}LogoutAuthUrl`);\r\n        }\r\n        this.onLogout.emit();\r\n      })\r\n      .catch(() => this.logoutError());\r\n  }\r\n}\r\n","import { Component } from '@angular/core';\r\n@Component({\r\n  templateUrl: './auth.component.html'\r\n})\r\nexport class FormioAuthComponent {}\r\n","<div class=\"card card-primary panel panel-default\">\r\n  <div class=\"card-header panel-heading\">\r\n    <ul class=\"nav nav-tabs card-header-tabs\">\r\n      <li class=\"nav-item\" role=\"presentation\" routerLinkActive=\"active\"><a class=\"nav-link\" routerLink=\"login\" routerLinkActive=\"active\">Login</a></li>\r\n      <li class=\"nav-item\" role=\"presentation\" routerLinkActive=\"active\"><a class=\"nav-link\" routerLink=\"register\" routerLinkActive=\"active\">Register</a></li>\r\n    </ul>\r\n  </div>\r\n  <div class=\"card-body panel-body\">\r\n    <router-outlet></router-outlet>\r\n  </div>\r\n</div>\r\n","import { Component } from '@angular/core';\r\nimport { FormioAuthService } from '../auth.service';\r\n@Component({\r\n  templateUrl: './login.component.html'\r\n})\r\nexport class FormioAuthLoginComponent {\r\n  public renderOptions: any = {\r\n    submitOnEnter: true\r\n  };\r\n  constructor(public service: FormioAuthService) {}\r\n}\r\n","<formio [src]=\"service.loginForm\" [renderOptions]=\"renderOptions\" (submit)=\"service.onLoginSubmit($event)\"></formio>\r\n","import { Component } from '@angular/core';\r\nimport { FormioAuthService } from '../auth.service';\r\n@Component({\r\n  templateUrl: './register.component.html'\r\n})\r\nexport class FormioAuthRegisterComponent {\r\n  public renderOptions: any = {\r\n    submitOnEnter: true\r\n  };\r\n  constructor(public service: FormioAuthService) {}\r\n}\r\n","<formio [src]=\"service.registerForm\" [renderOptions]=\"renderOptions\" (submit)=\"service.onRegisterSubmit($event)\"></formio>\r\n","import { Component } from '@angular/core';\r\nimport { FormioAuthService } from '../auth.service';\r\n@Component({\r\n  templateUrl: './resetpass.component.html'\r\n})\r\nexport class FormioResetPassComponent {\r\n  constructor(public service: FormioAuthService) {}\r\n}\r\n","<formio [src]=\"service.resetPassForm\" (submit)=\"service.onResetPassSubmit($event)\"></formio>\r\n","import { Routes } from '@angular/router';\r\nimport { FormioAuthRouteConfig } from './auth.config';\r\nimport { FormioAuthComponent } from './auth.component';\r\nimport { FormioAuthLoginComponent } from './login/login.component';\r\nimport { FormioAuthRegisterComponent } from './register/register.component';\r\nimport { FormioResetPassComponent } from './resetpass/resetpass.component';\r\n\r\nexport function FormioAuthRoutes(config?: FormioAuthRouteConfig): Routes {\r\n  return [\r\n    {\r\n      path: '',\r\n      component: config && config.auth ? config.auth : FormioAuthComponent,\r\n      children: [\r\n        {\r\n          path: '',\r\n          redirectTo: 'login',\r\n          pathMatch: 'full'\r\n        },\r\n        {\r\n          path: 'login',\r\n          component: config && config.login ? config.login : FormioAuthLoginComponent\r\n        },\r\n        {\r\n          path: 'register',\r\n          component: config && config.register ? config.register : FormioAuthRegisterComponent\r\n        },\r\n        {\r\n          path: 'resetpass',\r\n          component: config && config.resetpass ? config.resetpass : FormioResetPassComponent\r\n        }\r\n      ]\r\n    }\r\n  ];\r\n}\r\n","import { NgModule } from \"@angular/core\";\r\nimport { CommonModule } from \"@angular/common\";\r\nimport { RouterModule } from \"@angular/router\";\r\nimport { FormioModule } from \"formioangular-colfuturo\";\r\nimport { FormioAuthComponent } from \"./auth.component\";\r\nimport { FormioAuthLoginComponent } from \"./login/login.component\";\r\nimport { FormioAuthRegisterComponent } from \"./register/register.component\";\r\nimport { FormioResetPassComponent } from \"./resetpass/resetpass.component\";\r\nimport { FormioAuthRouteConfig } from \"./auth.config\";\r\nimport { FormioAuthRoutes } from \"./auth.routes\";\r\nimport { extendRouter } from \"formioangular-colfuturo\";\r\n\r\n@NgModule({\r\n  imports: [CommonModule, FormioModule, RouterModule],\r\n  declarations: [\r\n    FormioAuthComponent,\r\n    FormioAuthLoginComponent,\r\n    FormioAuthRegisterComponent,\r\n    FormioResetPassComponent,\r\n  ],\r\n})\r\nexport class FormioAuth {\r\n  static forRoot(config?: FormioAuthRouteConfig): any {\r\n    return extendRouter(FormioAuth, config, FormioAuthRoutes);\r\n  }\r\n  static forChild(config?: FormioAuthRouteConfig): any {\r\n    return extendRouter(FormioAuth, config, FormioAuthRoutes);\r\n  }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1","i2.FormioAuthConfig","i1.FormioAuthService"],"mappings":";;;;;;;;;;MAgBa,gBAAgB,CAAA;AAC3B,IAAA,SAAS;AACT,IAAA,SAAS;AACT,IAAA,KAAK;AACL,IAAA,QAAQ;AACR,IAAA,SAAS;AACT,IAAA,KAAK;wGANM,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;4GAAhB,gBAAgB,EAAA,CAAA;;4FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B;;AAgBD,IAAY,eAGX;AAHD,C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