Interface IScriptBuilder
- Assembly
- Diffusion.Client.dll
The script builder used to create a script of commands to apply to the system authentication store at the server.
public interface IScriptBuilder
Remarks
Each method call on the builder adds a line to the script and then the script may be built using the
ToScript() method which produces a System.String script which may be sent
to the server using UpdateStoreAsync(string).
This builder can be accessed with the Script property.
From Diffusion 6.5, script builders are no longer immutable. Each builder operation mutates this script builder and returns it.
Methods
AbstainAnonymousConnections()
Instructs the system authentication handler to defer authentication decisions for anonymous connections to subsequent handlers.
IScriptBuilder AbstainAnonymousConnections()
Returns
- IScriptBuilder
This builder, modified to abstain anonymous connections.
AddPrincipal(string, string, IEnumerable<string>)
Adds a new principal.
IScriptBuilder AddPrincipal(string name, string password, IEnumerable<string> roles)
Parameters
namestringThe principal name.
passwordstringThe password.
rolesIEnumerable<string>The roles to be assigned to the principal.
Returns
- IScriptBuilder
This builder, modified to add the new principal.
Remarks
The script will fail if the principal is already defined at the server.
AddPrincipal(string, string, IEnumerable<string>, string)
Adds a new locked principal.
IScriptBuilder AddPrincipal(string name, string password, IEnumerable<string> roles, string lockingPrincipal)
Parameters
namestringThe principal name.
passwordstringThe password.
rolesIEnumerable<string>The roles to be assigned to the principal.
lockingPrincipalstringThe name of the principal that can edit this principal.
Returns
- IScriptBuilder
This builder, modified to add the new locked principal.
Remarks
A locked principal can only be edited by the principal defined in the lock. The script will fail if the principal is already defined at the server.
AllowAnonymousConnections(IEnumerable<string>)
Instructs the system authentication handler to allow anonymous connections.
IScriptBuilder AllowAnonymousConnections(IEnumerable<string> roles)
Parameters
rolesIEnumerable<string>The roles to assign to anonymous sessions.
Returns
- IScriptBuilder
This builder, modified to allow anonymous connections.
Append(IScriptBuilder)
Appends all the operations of a given builder to the current builder.
IScriptBuilder Append(IScriptBuilder other)
Parameters
otherIScriptBuilderThe builder to append to the current builder.
Returns
- IScriptBuilder
A new copy of the current builder that also includes all operations of
other.
AssignRoles(string, IEnumerable<string>)
Changes a principal's assigned roles.
IScriptBuilder AssignRoles(string principal, IEnumerable<string> roles)
Parameters
principalstringThe principal name.
rolesIEnumerable<string>The roles to be assigned to the
principal.
Returns
- IScriptBuilder
This builder, modified to assign the new roles.
Remarks
The specified principal must already be defined at the server.
DenyAnonymousConnections()
Instructs the system authentication handler to deny anonymous connections.
IScriptBuilder DenyAnonymousConnections()
Returns
- IScriptBuilder
This builder, modified to deny anonymous connections.
IgnoreClientProposedProperty(string)
Specifies the name of a client proposed session property that should now be ignored by the system authenticator. This removes the effect of a previous request to trust the named property.
IScriptBuilder IgnoreClientProposedProperty(string propertyName)
Parameters
propertyNamestringSpecifies the name of the client proposed property to be ignored.
Returns
- IScriptBuilder
This builder, modified to ignore the specified client proposed property.
RemovePrincipal(string)
Removes a principal.
IScriptBuilder RemovePrincipal(string principal)
Parameters
principalstringThe principal name.
Returns
- IScriptBuilder
This builder, modified to remove the principal.
Remarks
The principal must be one that is already defined at the server.
SetPassword(string, string)
Sets a principal's password.
IScriptBuilder SetPassword(string principal, string password)
Parameters
Returns
- IScriptBuilder
This builder, modified to set the password.
Remarks
The principal must already be defined at the server in order to set the password.
ToScript()
Creates a new script.
string ToScript()
Returns
- string
The script.
TrustClientProposedPropertyIn(string, IEnumerable<string>)
Specifies the name of a client proposed session property that should be allowed by the system authenticator along with a set of permissible values. The property will only be allowed if the supplied value matches one of those in the set of values specified.
IScriptBuilder TrustClientProposedPropertyIn(string propertyName, IEnumerable<string> allowedValues)
Parameters
propertyNamestringSpecifies the name of the client proposed property to be allowed.
allowedValuesIEnumerable<string>Specifies a set of allowed values for the client proposed property.
Returns
- IScriptBuilder
This builder, modified to allow the specified client proposed property if its value matches one of those supplied.
TrustClientProposedPropertyMatches(string, string)
Specifies the name of a client proposed session property that should be allowed by the system authenticator along with a regular expression to validate the property value. The property will only be allowed if the supplied value matches with the regular expression.
IScriptBuilder TrustClientProposedPropertyMatches(string propertyName, string regex)
Parameters
propertyNamestringSpecifies the name of the client proposed property to be allowed.
regexstring- Regular expression which will be matched against supplied values to determine whether they are valid.
Returns
- IScriptBuilder
This builder, modified to allow the specified client proposed property if its value matches the given regular expression.
VerifyPassword(string, string)
Asserts that a principal's password is the same as the given password.
IScriptBuilder VerifyPassword(string principal, string password)
Parameters
Returns
- IScriptBuilder
This builder, modified to verify the password.
Remarks
This command does not update the store. It can be used in conjunction with SetPassword(string, string) to create a script that updates a password only if the previous password is supplied.