Table of Contents

Class UserAuthorizationOptions

Namespace
Microsoft.Agents.Builder.App.UserAuth
Assembly
Microsoft.Agents.Builder.dll

Options for user authorization.

public class UserAuthorizationOptions
Inheritance
UserAuthorizationOptions
Inherited Members

Constructors

UserAuthorizationOptions(IConnections, params IUserAuthorization[])

public UserAuthorizationOptions(IConnections connections, params IUserAuthorization[] userAuthHandlers)

Parameters

connections IConnections
userAuthHandlers IUserAuthorization[]

UserAuthorizationOptions(IServiceProvider, IConfiguration, IStorage, AutoSignInSelectorAsync, string)

Creates UserAuthorizationOptions from IConfiguration and DI.

public UserAuthorizationOptions(IServiceProvider sp, IConfiguration configuration, IStorage storage = null, AutoSignInSelectorAsync autoSignInSelector = null, string configKey = "UserAuthorization")

Parameters

sp IServiceProvider
configuration IConfiguration
storage IStorage
autoSignInSelector AutoSignInSelectorAsync
configKey string

Remarks

The "AuthSignIn" property will map to AutoSignInOn or AutoSignInOff. To provide a a custom selector, DI a AutoSignInSelectorAsync.

Fields

AutoSignInOff

public static readonly AutoSignInSelectorAsync AutoSignInOff

Field Value

AutoSignInSelectorAsync

AutoSignInOn

public static readonly AutoSignInSelectorAsync AutoSignInOn

Field Value

AutoSignInSelectorAsync

Properties

AutoSignIn

Indicates whether the Agent should start the sign in flow when the user sends a message to the Agent or triggers a message extension. If the selector returns false, the Agent will not start the sign in flow before routing the activity to the Agent logic. If the selector is not provided, the default selector returns true.

public AutoSignInSelectorAsync? AutoSignIn { get; set; }

Property Value

AutoSignInSelectorAsync

Remarks

Auto SignIn will use the value of DefaultHandlerName for the UserAuthorization handler to use.

DefaultHandlerName

The default user authorization handler name to use for AutoSignIn. If not specified, the first handler defined is used if Auto SignIn is enabled.

public string DefaultHandlerName { get; set; }

Property Value

string

SignInFailedMessage

Optional sign in failure message. This is only used if the OnUserSignInFailure(AuthorizationFailure) is not set.

public Func<string, SignInResponse, IActivity[]> SignInFailedMessage { get; set; }

Property Value

Func<string, SignInResponse, IActivity[]>