1import{a as _e,b as Ae,c as v}from"./chunk-GRXDDXEX.js";import{a as xe}from"./chunk-NWSSGM7S.js";import"./chunk-FWTG5XIZ.js";import{b as se}from"./chunk-YTUPXUHF.js";import"./chunk-NVKXDWWT.js";import"./chunk-OIRFSLWN.js";import{i as ye}from"./chunk-ACJ3NLO5.js";import{E as be,J as Ce,d as pe,f as ce,g as me,h as le,j as ue,o as he,s as fe,x as de,y as ge,z as Se}from"./chunk-GPVZISOV.js";import"./chunk-FQ4W3A5M.js";import{a as ve}from"./chunk-45WCVJBT.js";import{d as re,f as ae}from"./chunk-74CDSVWG.js";import{M as Z,R as ee,U as te,ha as oe,i as Y,ja as ie,ka as ne,q as b,u as Ee}from"./chunk-SEQCRKB6.js";import{Aa as m,B as D,C as N,Db as $,E as P,Ea as B,Fa as F,Ga as u,Ma as q,O as k,R as M,Tb as K,U as f,V,Y as r,Ya as z,Z as _,_ as A,_a as G,cb as S,db as W,eb as w,f as Oe,fb as H,ia as c,la as j,ma as L,n as R,o as T,ob as J,pa as U,pb as Q,qa as d,rb as X,s as p,u as h,xa as s,ya as l,za as g}from"./chunk-HBLARLGW.js";var C=class{constructor(t,n){this.clientName=t,this.grantableScopes=n}},y=class{constructor(t){this.scope=t}},x=class{constructor(t){this.scopes=t}hasScopes(){return this.scopes.length>0}};var O=(()=>{let t=class t{constructor(){this.http=r($),this.flowPageService=r(ae),this.flowSessionService=r(oe),this.scopesService=r(v),this.validations=r(ne),this.pageAlertService=r(Y),this.languageService=r(ee)}getConsent(){return D(this.onLanguageChange(),this.onStepUiConfig())}grant(e){let i=JSON.stringify({scopes:e.scopes.filter(a=>a.scope.granted).map(a=>a.scope.scope)});return this.http.post(b(["public","authentication","oauth2","authorization-server","consent","local","grant"]),i,re()).pipe(p(a=>this.flowSessionService.createFlowSession(a)),P(a=>this.handleValidationFailed(a)))}deny(){return this.http.post(b(["public","authentication","oauth2","authorization-server","consent","local","deny"]),null,{observe:"response"}).pipe(p(e=>this.flowSessionService.createFlowSession(e)))}onStepUiConfig(){return this.flowPageService.getStepUiConfig().pipe(h(e=>{let i=e.additionalAttribute("consent");return i?R(this.toConsent(i)):this.getConsentFromServer()}))}onLanguageChange(){return this.languageService.onLanguageChange.pipe(h(()=>this.getConsentFromServer()))}getConsentFromServer(){return this.http.post(b(["public","authentication","oauth2","authorization-server","consent","local","retrieve"]),null,{observe:"response"}).pipe(p(e=>this.toConsent({clientName:e.body.data.attributes.clientName,grantableScopes:e.body.data.attributes.grantableScopes})))}toConsent(e){return new C(e.clientName,this.toGrantableScopes(this.scopesService.createOAuth2Scopes(e.grantableScopes||[])))}handleValidationFailed(e){return this.hasScopesRequiredError(e)?(this.pageAlertService.error("error.oauth2-consent-scope-value-required").display(),N):T(()=>e)}hasScopesRequiredError(e){return this.validations.getServerValidationErrorsWithCodes(e,["VALIDATION_FAILED"]).filter(a=>a.source?.pointer==="/scopes"&&a.meta?.detail==="REQUIRED").length>0}toGrantableScopes(e){return new x(e.scopes.map(i=>new y(i)))}};t.\u0275fac=function(i){return new(i||t)},t.\u0275prov=f({token:t,factory:t.\u0275fac});let o=t;return o})();var Fe=Oe(Ee());var Re=o=>({date:o});function Te(o,t){o&1&&m(0,"iam-text-message",8),o&2&&s("id","empty-scopes")("text","authentication.oauth2.consent.empty-scopes")}function De(o,t){if(o&1&&(m(0,"iam-checkbox",11),S(1,"formatDate"),S(2,"translate")),o&2){let n=t.$implicit,e=u(3);s("id","scope-"+n.scope.scope)("label",n.scope.translatedScope+" "+w(2,6,e.scopeLabelResource(n.scope),G(9,Re,w(1,3,n.scope.updatedAt,e.formatDateOnly()))))("control",e.form.controls[n.scope.scope])}}function Ne(o,t){if(o&1&&(l(0,"iam-row-with-label",9),d(1,De,3,11,"iam-checkbox",10),g()),o&2){let n=u().ngIf;s("id","grantableOAuth2Scopes")("label","authentication.oauth2.consent.scopes.authorization"),c(),s("ngForOf",n.grantableScopes.scopes)}}function Pe(o,t){if(o&1){let n=B();l(0,"iam-page",2),m(1,"iam-text-row",3),l(2,"iam-form",4),F("formSubmit",function(){_(n);let i=u();return A(i.grant())}),d(3,Te,1,2,"iam-text-message",5)(4,Ne,2,3,"ng-template",null,0,H),m(6,"iam-dynamic-step-activation-checkboxes"),l(7,"iam-button-row"),m(8,"iam-button",6),l(9,"iam-button",7),F("buttonClick",function(){_(n);let i=u();return A(i.deny())}),g(),m(10,"iam-goto-buttons"),g()()()}if(o&2){let n=t.ngIf,e=q(5),i=u();s("pageId",i.pageId)("bodyAttributes",i.bodyAttributes)("title","authentication.oauth2.consent.title"),c(),s("id","clientName")("label","authentication.oauth2.consent.client.name")("value",n.clientName),c(),s("form",i.form),c(),s("ngIf",!n.grantableScopes.hasScopes())("ngIfElse",e),c(5),s("id","grantOAuth2Scopes")("submit",!0)("text","authentication.oauth2.consent.actions.grant")("disabled",!i.form.valid),c(),s("id","denyConsent")("text","authentication.oauth2.consent.actions.deny")}}var we=(()=>{let t=class t extends xe{constructor(){super(),this.service=r(O)}get pageId(){return"iamAuthOAuth2Consent"}ngOnInit(){this.consent=this.initUiConfig().pipe(k(()=>this.service.getConsent()),M(e=>this.initForm(e)))}grant(){this.service.grant(this.form.model).subscribe({next:e=>this.handleSuccessfulStep(e),error:e=>this.handleFailedStep(e)})}deny(){this.service.deny().subscribe({next:e=>this.handleSuccessfulStep(e),error:e=>this.handleFailedStep(e)})}formatDateOnly(){return Z.DATE}scopeLabelResource(e){return e.updatedAt?e.granted?"authentication.oauth2.consent.scopes.previously.granted":"authentication.oauth2.consent.scopes.previously.denied":""}initForm(e){this.form=ie.of((0,Fe.cloneDeep)(e.grantableScopes),{prefixOrMapping:this.controlsMapping(e.grantableScopes)})}
1controlsMapping(e){let i={};return e.scopes.forEach((a,Ie)=>{i["scopes["+Ie+"].scope.granted"]=a.scope.scope}),i}};t.\u0275fac=function(i){return new(i||t)},t.\u0275cmp=j({type:t,selectors:[["ng-component"]],standalone:!1,features:[z([O,{provide:_e,useValue:"authentication.oauth2.consent.scope."},v,Ae]),U],decls:2,vars:3,consts:[["scopeInstructions",""],[3,"pageId","bodyAttributes","title",4,"ngIf"],[3,"pageId","bodyAttributes","title"],[3,"id","label","value"],[3,"formSubmit","form"],[3,"id","text",4,"ngIf","ngIfElse"],[3,"id","submit","text","disabled"],[3,"buttonClick","id","text"],[3,"id","text"],[3,"id","label"],[3,"id","label","control",4,"ngFor","ngForOf"],[3,"id","label","control"]],template:function(i,a){i&1&&(d(0,Pe,11,15,"iam-page",1),S(1,"async")),i&2&&s("ngIf",W(1,1,a.consent))},dependencies:[J,Q,ce,me,de,be,ue,fe,le,he,ge,Ce,X,pe,Se],encapsulation:2});let o=t;return o})();var E=(()=>{let t=class t{constructor(){this.uiService=r(se),this.routes=r(te)}canActivate(){return this.uiService.getStepUiConfig().pipe(p(e=>e.additionalAttribute("consent")),h(e=>this.redirectToRemoteConsent(e)),p(()=>!1))}redirectToRemoteConsent(e){return this.routes.navigateTo(e.redirectUrl,{queryParamsHandling:"merge",queryParams:{consent_token:e.token}})}};t.\u0275fac=function(i){return new(i||t)},t.\u0275prov=f({token:t,factory:t.\u0275fac});let o=t;return o})();var ke=[{path:"",component:we,pathMatch:"full",runGuardsAndResolvers:"always"},{path:"redirect",canActivate:[()=>r(E).canActivate()],component:ve}],kt=(()=>{let t=class t{};t.\u0275fac=function(i){return new(i||t)},t.\u0275mod=L({type:t}),t.\u0275inj=V({providers:[E],imports:[K.forChild(ke),ye]});let o=t;return o})();export{kt as OAuth2ConsentModule};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.