File

auth-configuration/sso-configuration/template-parts/request-configuration.component.ts

Metadata

Index

Methods
Inputs
Accessors

Constructor

constructor(controlContainer: ControlContainer)
Parameters :
Name Type Optional
controlContainer ControlContainer No

Inputs

requestName
Type : string
requestType
Type : "authorizationRequest" | "tokenRequest" | "refreshRequest" | "logoutRequest" | "tokenValidationRequest"
templateModel
Type : any

Methods

addCustomValue
addCustomValue(array)
Parameters :
Name Optional
array No
Returns : void
removeCustomValue
removeCustomValue(array, customValue)
Parameters :
Name Optional
array No
customValue No
Returns : void
shouldShow
shouldShow(field: string)
Decorators :
@memoize()
Parameters :
Name Type Optional
field string No
Returns : boolean

Accessors

requestConfiguration
getrequestConfiguration()
showBody
getshowBody()
<fieldset
  class="p-24"
  ngModelGroup="{{ requestName }}"
  id="{{ requestType }}"
>
  <div class="row">
    <div
      class="col-xs-12 col-sm-3 col-md-2 m-b-xs-8"
      *ngIf="requestType !== 'tokenValidationRequest'"
    >
      <div class="h4 text-normal text-right text-left-xs">
        {{ requestName }}
      </div>
    </div>

    <div
      [ngClass]="
        requestType !== 'tokenValidationRequest' ? 'col-xs-12 col-sm-9 col-md-10 col-lg-9' : ''
      "
      *ngIf="templateModel"
    >
      <fieldset [ngClass]="requestType === 'tokenValidationRequest' ? 'c8y-fieldset p-24' : ''">
        <legend *ngIf="requestType === 'tokenValidationRequest'">
          {{ requestName }}
        </legend>

        <c8y-form-group>
          <label
            [for]="requestType + 'url'"
            class="control-label"
            translate
          >
            URL
          </label>
          <input
            type="url"
            class="form-control"
            name="url"
            [id]="requestType + 'url'"
            [(ngModel)]="requestConfiguration.url"
            [placeholder]="'e.g. {{ example }}' | translate: { example: 'http://www.example.com/' }"
            c8yDefaultValidation="httpUrl"
            [required]="requestType !== 'logoutRequest'"
          />
        </c8y-form-group>

        <c8y-form-group *ngIf="showBody">
          <label
            [for]="requestType + 'body'"
            class="control-label"
            translate
          >
            Body
          </label>
          <input
            type="text"
            class="form-control"
            name="body"
            [id]="requestType + 'body'"
            [(ngModel)]="requestConfiguration.body"
            required
          />
        </c8y-form-group>
      </fieldset>

      <fieldset
        class="c8y-fieldset p-24"
        *ngIf="requestType !== 'logoutRequest'"
      >
        <legend translate>Headers</legend>
        <div
          class="tight-grid visible-md visible-lg"
          *ngIf="requestConfiguration.headers.length > 0"
        >
          <div class="col-md-6">
            <p class="text-medium">
              {{ 'Key' | translate }}
            </p>
          </div>
          <div class="col-md-5">
            <p class="text-medium">
              {{ 'Value' | translate }}
            </p>
          </div>
        </div>
        <div
          class="tight-grid"
          data-cy="c8y-authentication-single-sign-on--request-header"
          *ngFor="let header of requestConfiguration.headers; index as headerIndex"
        >
          <div class="col-md-6">
            <c8y-form-group>
              <label
                [for]="requestType + 'headerKey' + headerIndex"
                class="visible-sm visible-xs"
                translate
              >
                Key
              </label>
              <input
                class="form-control"
                [name]="'headerKey' + headerIndex"
                [id]="requestType + 'headerKey' + headerIndex"
                [(ngModel)]="header.key"
                [placeholder]="'e.g. {{ example }}' | translate: { example: 'Authorization' }"
                required
              />
            </c8y-form-group>
          </div>
          <div class="col-md-5">
            <c8y-form-group>
              <label
                [for]="requestType + 'headerValue' + headerIndex"
                class="visible-sm visible-xs"
                translate
              >
                Value
              </label>
              <input
                class="form-control"
                [name]="'headerValue' + headerIndex"
                [id]="requestType + 'headerValue' + headerIndex"
                [(ngModel)]="header.value"
                [placeholder]="
                  'e.g. {{ example }}' | translate: { example: 'Basic USY7jW9jb2RlX2=' }
                "
                required
              />
            </c8y-form-group>
          </div>
          <div class="col-md-1">
            <c8y-form-group>
              <button
                class="btn btn-link hidden-xs hidden-sm"
                type="button"
                title="{{ 'Remove' | translate }}"
                (click)="removeCustomValue(requestConfiguration.headers, header)"
              >
                <i
                  c8yIcon="minus-circle"
                  class="text-danger"
                ></i>
              </button>
              <button
                class="btn btn-danger btn-block btn-sm visible-xs visible-sm"
                title="{{ 'Remove' | translate }}"
                type="button"
                (click)="removeCustomValue(requestConfiguration.headers, header)"
              >
                <i c8yIcon="minus-circle"></i>
                <span translate>Remove</span>
              </button>
            </c8y-form-group>
          </div>
        </div>
        <button
          class="btn btn-default m-t-8"
          type="button"
          title="{{ 'Add header' | translate }}"
          (click)="addCustomValue(requestConfiguration.headers)"
        >
          <i
            c8yIcon="plus-circle"
            class="m-r-4"
          ></i>
          <span translate>Add header</span>
        </button>
      </fieldset>

      <fieldset class="c8y-fieldset p-24">
        <legend translate>Request parameters</legend>
        <div
          class="tight-grid visible-md visible-lg"
          *ngIf="requestConfiguration.requestParams.length > 0"
        >
          <div class="col-md-6">
            <p class="text-medium">
              {{ 'Key' | translate }}
            </p>
          </div>
          <div class="col-md-5">
            <p class="text-medium">
              {{ 'Value' | translate }}
            </p>
          </div>
        </div>
        <div
          class="tight-grid"
          data-cy="c8y-authentication-single-sign-on--request-parameter"
          *ngFor="let requestParam of requestConfiguration.requestParams; index as paramIndex"
        >
          <div class="col-md-6">
            <c8y-form-group>
              <label
                [for]="requestType + 'paramKey' + paramIndex"
                class="visible-sm visible-xs"
                translate
              >
                Key
              </label>
              <input
                class="form-control"
                [name]="'paramKey' + paramIndex"
                [id]="requestType + 'paramKey' + paramIndex"
                [(ngModel)]="requestParam.key"
                [placeholder]="'e.g. {{ example }}' | translate: { example: 'client_id' }"
                required
              />
            </c8y-form-group>
          </div>

          <div class="col-md-5">
            <c8y-form-group>
              <label
                [for]="requestType + 'paramValue' + paramIndex"
                class="visible-sm visible-xs"
                translate
              >
                Value
              </label>
              <input
                class="form-control"
                [name]="'paramValue' + paramIndex"
                [id]="requestType + 'paramValue' + paramIndex"
                [(ngModel)]="requestParam.value"
                [placeholder]="'e.g. {{ example }}' | translate: { example: '${clientId}' }"
                required
              />
            </c8y-form-group>
          </div>

          <div class="col-md-1">
            <c8y-form-group>
              <button
                class="btn btn-link hidden-xs hidden-sm"
                type="button"
                title="{{ 'Remove' | translate }}"
                (click)="removeCustomValue(requestConfiguration.requestParams, requestParam)"
              >
                <i
                  c8yIcon="minus-circle"
                  class="text-danger"
                ></i>
              </button>

              <button
                class="btn btn-danger btn-block btn-sm visible-xs visible-sm"
                type="button"
                title="{{ 'Remove' | translate }}"
                (click)="removeCustomValue(requestConfiguration.requestParams, requestParam)"
              >
                <i c8yIcon="minus-circle"></i>
                <span translate>Remove</span>
              </button>
            </c8y-form-group>
          </div>
        </div>

        <button
          class="btn btn-default m-t-8"
          type="button"
          title="{{ 'Add request parameter' | translate }}"
          (click)="addCustomValue(requestConfiguration.requestParams)"
        >
          <i
            c8yIcon="plus-circle"
            class="m-r-4"
          ></i>
          <span translate>Add request parameter</span>
        </button>
      </fieldset>
    </div>
  </div>
</fieldset>

results matching ""

    No results matching ""