@digitalpersona/services
Version:
DigitalPersona Web Access Services
3 lines (2 loc) • 9.86 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@digitalpersona/core")):"function"==typeof define&&define.amd?define(["exports","@digitalpersona/core"],t):t(((e=e||self).dp=e.dp||{},e.dp.services=e.dp.services||{}),e.dp.core)}(this,function(e,t){"use strict";var n,r,s,i,o,l,u,c,a,d,p,h;(n=e.VarType||(e.VarType={}))[n.Boolean=1]="Boolean",n[n.Integer=2]="Integer",n[n.String=3]="String",n[n.Blob=4]="Blob";(r=e.AttributeAction||(e.AttributeAction={}))[r.Clear=1]="Clear",r[r.Update=2]="Update",r[r.Append=3]="Append",r[r.Delete=4]="Delete",(s=e.ResourceActions||(e.ResourceActions={}))[s.Read=0]="Read",s[s.Write=1]="Write",s[s.Delete=2]="Delete";class A extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,new.target.prototype)}static fromServiceFault(e){return new A(e.error_code,e.description)}isHttpError(){return this.code>=400&&this.code<600}}(i=e.DatabaseType||(e.DatabaseType={})).AD="AD",i.LDS="ADLDS";(o=e.AuthenticationStatus||(e.AuthenticationStatus={}))[o.Error=0]="Error",o[o.Continue=1]="Continue",o[o.Completed=2]="Completed";class U{constructor(e,t){this.defaultRequest={cache:"no-cache",mode:"cors",headers:{"Content-Type":"application/json;charset=utf-8",Accept:"application/json"}},this.endpointUrl=e,this.defaultRequest=t||this.defaultRequest}static handleResponse(e){return e.ok?e.json():U.handleError(e)}static handleError(e){if(404===e.status)return e.json().then(t=>{throw t?new A(t.error_code,t.description):new A(e.status,e.statusText)});throw new A(e.status,e.statusText)}get(e,n,r){return fetch(t.Url.create(this.endpointUrl,e,n),Object.assign(Object.assign(Object.assign({},this.defaultRequest),r),{method:"GET"})).then(U.handleResponse)}post(e,n,r,s){return fetch(t.Url.create(this.endpointUrl,e,n),Object.assign(Object.assign(Object.assign(Object.assign({},this.defaultRequest),s),{method:"POST"}),r?{body:JSON.stringify(r)}:{})).then(U.handleResponse)}put(e,n,r,s){return fetch(t.Url.create(this.endpointUrl,e,n),Object.assign(Object.assign(Object.assign(Object.assign({},this.defaultRequest),s),{method:"PUT"}),r?{body:JSON.stringify(r)}:{})).then(U.handleResponse)}del(e,n,r,s){return fetch(t.Url.create(this.endpointUrl,e,n),Object.assign(Object.assign(Object.assign(Object.assign({},this.defaultRequest),s),{method:"DELETE"}),r?{body:JSON.stringify(r)}:{})).then(U.handleResponse)}ping(e="Ping"){return fetch(t.Url.create(this.endpointUrl,e),Object.assign(Object.assign({},this.defaultRequest),{method:"GET"})).then(e=>e.ok).catch(e=>!1)}}class S{constructor(e){this.endpoint=new U(e)}Ping(){return this.endpoint.ping()}}(l=e.TriggerName||(e.TriggerName={})).Behavior="behavior",l.IP="ip",l.Device="device",l.AltusInstalled="altusInstalled",l.Computer="computer",l.Domain="domain",l.User="user",l.InsideFirewall="insideFirewall",l.RemoteSession="remoteSession";(u=e.LicenseType||(e.LicenseType={}))[u.ADUser=1]="ADUser",u[u.LDSUser=2]="LDSUser",(c=e.SearchScope||(e.SearchScope={}))[c.Base=0]="Base",c[c.OneLevel=1]="OneLevel",c[c.Subtree=2]="Subtree",(a=e.ServerSettingType||(e.ServerSettingType={}))[a.Unknown=0]="Unknown",a[a.Admin=1]="Admin",a[a.Public=2]="Public",(d=e.ServerSettings||(e.ServerSettings={}))[d.LockoutThreshold=0]="LockoutThreshold",d[d.LockoutDuration=1]="LockoutDuration",d[d.LockoutReset=2]="LockoutReset",(p=e.UACFlags||(e.UACFlags={}))[p.RevertToWindows=1]="RevertToWindows",p[p.PasswordNotAllowed=2]="PasswordNotAllowed",p[p.PinRequired=4]="PinRequired",p[p.FingerprintRequired=8]="FingerprintRequired",p[p.FingerprintOnly=16]="FingerprintOnly",p[p.OtpAndPwd=64]="OtpAndPwd",p[p.OtpAndFingerprint=128]="OtpAndFingerprint",(h=e.UserAccountType||(e.UserAccountType={}))[h.Unknown=0]="Unknown",h[h.Local=1]="Local",h[h.ActiveDirectory=2]="ActiveDirectory",h[h.ADLDS=3]="ADLDS";e.AdminService=class extends S{constructor(e){super(e)}ExecuteSearch(e,t){return this.endpoint.post("ExecuteSearch",null,Object.assign({ticket:e},t)).then(e=>JSON.parse(e.ExecuteSearchResult))}PSKCImport(e,t,n,r,s){return this.endpoint.post("PSKCImport",null,{ticket:e,PSKCData:t,PSKCFileName:n,password:r,sharedKey:s}).then(e=>e.PSKCImportResult)}GetServerSettings(e,t,n){return this.endpoint.post("GetServerSettings",null,{ticket:e,user:t,settings:n}).then(e=>e.GetServerSettingsResult)}SetServerSettings(e,t,n){return this.endpoint.put("SetServerSettings",null,{ticket:e,type:t,settings:n})}GetLicenseInfo(e){return this.endpoint.get("GetLicenseInfo",{type:e}).then(e=>e.GetLicenseInfoResult)}GetUserRecoveryPassword(e,t,n){return this.endpoint.post("GetUserRecoveryPassword",null,{ticket:e,user:t,encryptedPwd:n}).then(e=>e.GetUserRecoveryPasswordResult)}AdminDeleteUserCredentials(e,t,n){return this.endpoint.del("AdminDeleteUserCredentials",null,{ticket:e,user:t,credentials:n})}GetUserInfo(e,t){return this.endpoint.post("GetUserInfo",null,{ticket:e,user:t}).then(e=>e.GetUserInfoResult)}UnlockUserAccount(e,t){return this.endpoint.put("UnlockUserAccount",null,{ticket:e,user:t})}SetUserAccountControl(e,t,n){return this.endpoint.put("SetUserAccountControl",null,{ticket:e,user:t,control:n})}},e.AuthService=class extends S{constructor(e){super(e)}GetUserCredentials(e){return this.endpoint.get("GetUserCredentials",{user:e.name,type:e.type}).then(e=>e.GetUserCredentialsResult)}GetEnrollmentData(e,t){return this.endpoint.get("GetEnrollmentData",{user:e.name,type:e.type,cred_id:t}).then(e=>e.GetEnrollmentDataResult)}Identify(e){return this.endpoint.post("IdentifyUser",null,{credential:e}).then(e=>new t.Ticket(e.IdentifyUserResult.jwt))}Authenticate(e,n){return e instanceof t.Ticket?this.endpoint.post("AuthenticateUserTicket",null,{ticket:e,credential:n}).then(e=>new t.Ticket(e.AuthenticateUserTicketResult.jwt)):this.endpoint.post("AuthenticateUser",null,{user:e,credential:n}).then(e=>new t.Ticket(e.AuthenticateUserResult.jwt))}CustomAction(e,t,n,r){return this.endpoint.post("CustomAction",null,{actionId:e,ticket:t,user:n,credential:r}).then(e=>e.CustomActionResult)}CreateAuthentication(e,n){return e instanceof t.Ticket?this.endpoint.post("CreateTicketAuthentication",null,{ticket:e,credentialId:n}).then(e=>e.CreateTicketAuthenticationResult):this.endpoint.post("CreateUserAuthentication",null,{user:e,credentialId:n}).then(e=>e.CreateUserAuthenticationResult)}ContinueAuthentication(e,t){return this.endpoint.post("ContinueAuthentication",null,{authId:e,authData:t}).then(e=>e.ContinueAuthenticationResult)}DestroyAuthentication(e){return this.endpoint.del("DestroyAuthentication",null,{authId:e})}},e.AuthenticationData=class{},e.ClaimRequest=class{constructor(e,t,n){this.name=e,this.db=t,this.attr=n}},e.ClaimsService=class extends S{constructor(e){super(e)}GetConfiguredClaims(e){return this.endpoint.post("GetConfiguredClaims",null,{ticket:e}).then(e=>e.GetConfiguredClaimsResult.ticket)}GetClaims(e,t){return this.endpoint.post("GetClaims",null,{ticket:e,request:t}).then(e=>e.GetClaimsResult.ticket)}},e.ContextualInfo=class{},e.EnrollService=class extends S{constructor(e){super(e)}GetUserCredentials(e){return this.endpoint.get("GetUserCredentials",{user:e.name,type:e.type}).then(e=>e.GetUserCredentialsResult)}GetEnrollmentData(e,t){return this.endpoint.get("GetEnrollmentData",{user:e.name,type:e.type,cred_id:t}).then(e=>e.GetEnrollmentDataResult)}CreateUser(e,t,n){return this.endpoint.put("CreateUser",null,{secOfficer:e,user:t,password:n})}DeleteUser(e,t){return this.endpoint.del("DeleteUser",null,{secOfficer:e,user:t})}EnrollUserCredentials(e,t,n){return this.endpoint.put("EnrollUserCredentials",null,{secOfficer:e,owner:t,credential:n})}DeleteUserCredentials(e,t,n){return this.endpoint.del("DeleteUserCredentials",null,{secOfficer:e,owner:t,credential:n})}EnrollAltusUserCredentials(e,t,n){return this.endpoint.put("EnrollAltusUserCredentials",null,{secOfficer:e,user:t,credential:n})}DeleteAltusUserCredentials(e,t,n){return this.endpoint.del("DeleteAltusUserCredentials",null,{secOfficer:e,user:t,credential:n})}GetUserAttribute(e,t,n){return this.endpoint.post("GetUserAttribute",null,{ticket:e,user:t,attributeName:n}).then(e=>({name:n,data:e.GetUserAttributeResult}))}PutUserAttribute(e,t,n,r){return this.endpoint.put("PutUserAttribute",null,{ticket:e,user:t,action:r,attributeName:n.name,attributeData:n.data})}UnlockUser(e,t){return this.endpoint.post("UnlockUser",null,{user:e,credential:t})}CustomAction(e,t,n,r){return this.endpoint.post("CustomAction",null,{ticket:e,user:t,credential:n,actionId:r}).then(e=>e.CustomActionResult)}IsEnrollmentAllowed(e,t,n){return this.endpoint.post("IsEnrollmentAllowed",null,{secOfficer:e,user:t,credentialId:n})}},e.PolicyService=class extends S{constructor(e){super(e)}GetPolicyInfo(e,t,n,r){return this.endpoint.post("GetPolicyInfo",null,{user:e,resourceUri:t,action:n,info:r}).then(e=>e.GetPolicyInfoResult)}},e.SecretService=class extends S{constructor(e){super(e)}GetAuthPolicy(e,t,n){return this.endpoint.get("GetAuthPolicy",{user:e.name,type:e.type,secretName:t,action:n}).then(e=>e.GetAuthPolicyResult)}DoesSecretExist(e,t){return this.endpoint.get("DoesSecretExist",{user:e.name,type:e.type,secretName:t}).then(e=>e.DoesSecretExistResult)}ReadSecret(e,t){return this.endpoint.post("ReadSecret",null,{ticket:e,secretName:t}).then(e=>e.ReadSecretResult)}WriteSecret(e,t,n){return this.endpoint.put("WriteSecret",null,{ticket:e,secretName:t,secretData:n})}DeleteSecret(e,t){return this.endpoint.del("DeleteSecret",null,{ticket:e,secretName:t})}},e.ServiceError=A,e.VarBlob=class{constructor(t){this.values=t,this.type=e.VarType.Blob}},e.VarBool=class{constructor(t){this.values=t,this.type=e.VarType.Boolean}},e.VarInt=class{constructor(t){this.values=t,this.type=e.VarType.Integer}},e.VarString=class{constructor(t){this.values=t,this.type=e.VarType.String}},Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=index.umd.min.js.map