...

Source file src/github.com/okta/okta-sdk-golang/v2/tests/integration/trusted_origin_test.go

Documentation: github.com/okta/okta-sdk-golang/v2/tests/integration

     1  /*
     2   * Copyright 2018 - Present Okta, Inc.
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *      http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  package integration
    18  
    19  import (
    20  	"context"
    21  	"testing"
    22  
    23  	"github.com/okta/okta-sdk-golang/v2/okta"
    24  	"github.com/okta/okta-sdk-golang/v2/tests"
    25  
    26  	"github.com/stretchr/testify/assert"
    27  	"github.com/stretchr/testify/require"
    28  )
    29  
    30  func Test_trusted_origin_for_iframe_embedding(t *testing.T) {
    31  	ctx, client, err := tests.NewClient(context.TODO())
    32  	require.NoError(t, err)
    33  
    34  	scopeCors := &okta.Scope{
    35  		Type: "CORS",
    36  	}
    37  	scopeIframe := &okta.Scope{
    38  		Type: "IFRAME_EMBED",
    39  	}
    40  	scopes := make([]*okta.Scope, 2)
    41  	scopes[0] = scopeCors
    42  	scopes[1] = scopeIframe
    43  
    44  	trustedOrigin := &okta.TrustedOrigin{
    45  		Name:   "Trusted Origin",
    46  		Origin: "http://example.com",
    47  		Scopes: scopes,
    48  	}
    49  
    50  	to, _, err := client.TrustedOrigin.CreateOrigin(ctx, *trustedOrigin)
    51  
    52  	require.NoError(t, err)
    53  
    54  	assert.IsType(t, &okta.TrustedOrigin{}, to)
    55  
    56  	client.TrustedOrigin.DeleteOrigin(ctx, to.Id)
    57  }
    58  

View as plain text