Okta

v3.16.0 published on Wednesday, Sep 28, 2022 by Pulumi

AppSignonPolicy

WARNING: This feature is only available as a part of the Identity Engine. Contact support for further information.

This resource allows you to create and configure a sign-on policy for the application. (Inside the product this is referenced as an authentication policy)

A newly create app sign-on policy will always contain a default Catch-all Rule.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Okta = Pulumi.Okta;

return await Deployment.RunAsync(() => 
{
    var myAppPolicy = new Okta.AppSignonPolicy("myAppPolicy", new()
    {
        Description = "Authentication Policy to be used on my app.",
    });

    var myApp = new Okta.App.OAuth("myApp", new()
    {
        Label = "My App",
        Type = "web",
        GrantTypes = new[]
        {
            "authorization_code",
        },
        RedirectUris = new[]
        {
            "http://localhost:3000",
        },
        PostLogoutRedirectUris = new[]
        {
            "http://localhost:3000",
        },
        ResponseTypes = new[]
        {
            "code",
        },
        AuthenticationPolicy = myAppPolicy.Id,
    });

});
package main

import (
	"github.com/pulumi/pulumi-okta/sdk/v3/go/okta"
	"github.com/pulumi/pulumi-okta/sdk/v3/go/okta/app"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		myAppPolicy, err := okta.NewAppSignonPolicy(ctx, "myAppPolicy", &okta.AppSignonPolicyArgs{
			Description: pulumi.String("Authentication Policy to be used on my app."),
		})
		if err != nil {
			return err
		}
		_, err = app.NewOAuth(ctx, "myApp", &app.OAuthArgs{
			Label: pulumi.String("My App"),
			Type:  pulumi.String("web"),
			GrantTypes: pulumi.StringArray{
				pulumi.String("authorization_code"),
			},
			RedirectUris: pulumi.StringArray{
				pulumi.String("http://localhost:3000"),
			},
			PostLogoutRedirectUris: pulumi.StringArray{
				pulumi.String("http://localhost:3000"),
			},
			ResponseTypes: pulumi.StringArray{
				pulumi.String("code"),
			},
			AuthenticationPolicy: myAppPolicy.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.okta.AppSignonPolicy;
import com.pulumi.okta.AppSignonPolicyArgs;
import com.pulumi.okta.app.OAuth;
import com.pulumi.okta.app.OAuthArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var myAppPolicy = new AppSignonPolicy("myAppPolicy", AppSignonPolicyArgs.builder()        
            .description("Authentication Policy to be used on my app.")
            .build());

        var myApp = new OAuth("myApp", OAuthArgs.builder()        
            .label("My App")
            .type("web")
            .grantTypes("authorization_code")
            .redirectUris("http://localhost:3000")
            .postLogoutRedirectUris("http://localhost:3000")
            .responseTypes("code")
            .authenticationPolicy(myAppPolicy.id())
            .build());

    }
}
import pulumi
import pulumi_okta as okta

my_app_policy = okta.AppSignonPolicy("myAppPolicy", description="Authentication Policy to be used on my app.")
my_app = okta.app.OAuth("myApp",
    label="My App",
    type="web",
    grant_types=["authorization_code"],
    redirect_uris=["http://localhost:3000"],
    post_logout_redirect_uris=["http://localhost:3000"],
    response_types=["code"],
    authentication_policy=my_app_policy.id)
import * as pulumi from "@pulumi/pulumi";
import * as okta from "@pulumi/okta";

const myAppPolicy = new okta.AppSignonPolicy("myAppPolicy", {description: "Authentication Policy to be used on my app."});
const myApp = new okta.app.OAuth("myApp", {
    label: "My App",
    type: "web",
    grantTypes: ["authorization_code"],
    redirectUris: ["http://localhost:3000"],
    postLogoutRedirectUris: ["http://localhost:3000"],
    responseTypes: ["code"],
    authenticationPolicy: myAppPolicy.id,
});
resources:
  myApp:
    type: okta:app:OAuth
    properties:
      label: My App
      type: web
      grantTypes:
        - authorization_code
      redirectUris:
        - http://localhost:3000
      postLogoutRedirectUris:
        - http://localhost:3000
      responseTypes:
        - code
      # this is needed to associate the application with the policy
      authenticationPolicy: ${myAppPolicy.id}
  myAppPolicy:
    type: okta:AppSignonPolicy
    properties:
      description: Authentication Policy to be used on my app.

.

using System.Collections.Generic;
using System.Text.Json;
using Pulumi;
using Okta = Pulumi.Okta;

return await Deployment.RunAsync(() => 
{
    var myAppPolicy = new Okta.AppSignonPolicy("myAppPolicy", new()
    {
        Description = "Authentication Policy to be used on my app.",
    });

    var someRule = new Okta.AppSignonPolicyRule("someRule", new()
    {
        PolicyId = resource.Okta_app_signon_policy.My_app_policy.Id,
        FactorMode = "1FA",
        ReAuthenticationFrequency = "PT43800H",
        Constraints = new[]
        {
            JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["knowledge"] = new Dictionary<string, object?>
                {
                    ["types"] = new[]
                    {
                        "password",
                    },
                },
            }),
        },
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-okta/sdk/v3/go/okta"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := okta.NewAppSignonPolicy(ctx, "myAppPolicy", &okta.AppSignonPolicyArgs{
			Description: pulumi.String("Authentication Policy to be used on my app."),
		})
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"knowledge": map[string]interface{}{
				"types": []string{
					"password",
				},
			},
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = okta.NewAppSignonPolicyRule(ctx, "someRule", &okta.AppSignonPolicyRuleArgs{
			PolicyId:                  pulumi.Any(resource.Okta_app_signon_policy.My_app_policy.Id),
			FactorMode:                pulumi.String("1FA"),
			ReAuthenticationFrequency: pulumi.String("PT43800H"),
			Constraints: pulumi.StringArray{
				pulumi.String(json0),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.okta.AppSignonPolicy;
import com.pulumi.okta.AppSignonPolicyArgs;
import com.pulumi.okta.AppSignonPolicyRule;
import com.pulumi.okta.AppSignonPolicyRuleArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var myAppPolicy = new AppSignonPolicy("myAppPolicy", AppSignonPolicyArgs.builder()        
            .description("Authentication Policy to be used on my app.")
            .build());

        var someRule = new AppSignonPolicyRule("someRule", AppSignonPolicyRuleArgs.builder()        
            .policyId(resource.okta_app_signon_policy().my_app_policy().id())
            .factorMode("1FA")
            .reAuthenticationFrequency("PT43800H")
            .constraints(serializeJson(
                jsonObject(
                    jsonProperty("knowledge", jsonObject(
                        jsonProperty("types", jsonArray("password"))
                    ))
                )))
            .build());

    }
}
import pulumi
import json
import pulumi_okta as okta

my_app_policy = okta.AppSignonPolicy("myAppPolicy", description="Authentication Policy to be used on my app.")
some_rule = okta.AppSignonPolicyRule("someRule",
    policy_id=resource["okta_app_signon_policy"]["my_app_policy"]["id"],
    factor_mode="1FA",
    re_authentication_frequency="PT43800H",
    constraints=[json.dumps({
        "knowledge": {
            "types": ["password"],
        },
    })])
import * as pulumi from "@pulumi/pulumi";
import * as okta from "@pulumi/okta";

const myAppPolicy = new okta.AppSignonPolicy("myAppPolicy", {description: "Authentication Policy to be used on my app."});
const someRule = new okta.AppSignonPolicyRule("someRule", {
    policyId: resource.okta_app_signon_policy.my_app_policy.id,
    factorMode: "1FA",
    reAuthenticationFrequency: "PT43800H",
    constraints: [JSON.stringify({
        knowledge: {
            types: ["password"],
        },
    })],
});
resources:
  myAppPolicy:
    type: okta:AppSignonPolicy
    properties:
      description: Authentication Policy to be used on my app.
  someRule:
    type: okta:AppSignonPolicyRule
    properties:
      policyId: ${resource.okta_app_signon_policy.my_app_policy.id}
      factorMode: 1FA
      reAuthenticationFrequency: PT43800H
      constraints:
        - Fn::ToJSON:
            knowledge:
              types:
                - password

Create AppSignonPolicy Resource

new AppSignonPolicy(name: string, args: AppSignonPolicyArgs, opts?: CustomResourceOptions);
@overload
def AppSignonPolicy(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    description: Optional[str] = None,
                    name: Optional[str] = None)
@overload
def AppSignonPolicy(resource_name: str,
                    args: AppSignonPolicyArgs,
                    opts: Optional[ResourceOptions] = None)
func NewAppSignonPolicy(ctx *Context, name string, args AppSignonPolicyArgs, opts ...ResourceOption) (*AppSignonPolicy, error)
public AppSignonPolicy(string name, AppSignonPolicyArgs args, CustomResourceOptions? opts = null)
public AppSignonPolicy(String name, AppSignonPolicyArgs args)
public AppSignonPolicy(String name, AppSignonPolicyArgs args, CustomResourceOptions options)
type: okta:AppSignonPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args AppSignonPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args AppSignonPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args AppSignonPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AppSignonPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args AppSignonPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

AppSignonPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The AppSignonPolicy resource accepts the following input properties:

Description string

Description of the policy.

Name string

Name of the policy.

Description string

Description of the policy.

Name string

Name of the policy.

description String

Description of the policy.

name String

Name of the policy.

description string

Description of the policy.

name string

Name of the policy.

description str

Description of the policy.

name str

Name of the policy.

description String

Description of the policy.

name String

Name of the policy.

Outputs

All input properties are implicitly available as output properties. Additionally, the AppSignonPolicy resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing AppSignonPolicy Resource

Get an existing AppSignonPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AppSignonPolicyState, opts?: CustomResourceOptions): AppSignonPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        name: Optional[str] = None) -> AppSignonPolicy
func GetAppSignonPolicy(ctx *Context, name string, id IDInput, state *AppSignonPolicyState, opts ...ResourceOption) (*AppSignonPolicy, error)
public static AppSignonPolicy Get(string name, Input<string> id, AppSignonPolicyState? state, CustomResourceOptions? opts = null)
public static AppSignonPolicy get(String name, Output<String> id, AppSignonPolicyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Description string

Description of the policy.

Name string

Name of the policy.

Description string

Description of the policy.

Name string

Name of the policy.

description String

Description of the policy.

name String

Name of the policy.

description string

Description of the policy.

name string

Name of the policy.

description str

Description of the policy.

name str

Name of the policy.

description String

Description of the policy.

name String

Name of the policy.

Package Details

Repository
https://github.com/pulumi/pulumi-okta
License
Apache-2.0
Notes

This Pulumi package is based on the okta Terraform Provider.