Class OpenIddictMessage
Represents an abstract OpenIddict message.
Inherited Members
Namespace: OpenIddict.Abstractions
Assembly: cs.temp.dll.dll
Syntax
public class OpenIddictMessage
Remarks
Security notice: developers instantiating this type are responsible of ensuring that the imported parameters are safe and won't cause the resulting message to grow abnormally, which may result in an excessive memory consumption and a potential denial of service.
Constructors
OpenIddictMessage()
Initializes a new OpenIddict message.
Declaration
public OpenIddictMessage()
OpenIddictMessage(JsonElement)
Initializes a new OpenIddict message.
Declaration
public OpenIddictMessage(JsonElement parameters)
Parameters
Type | Name | Description |
---|---|---|
JsonElement | parameters | The message parameters. |
Remarks
Parameters with a null or empty key are always ignored.
OpenIddictMessage(IEnumerable<KeyValuePair<String, OpenIddictParameter>>)
Initializes a new OpenIddict message.
Declaration
public OpenIddictMessage(IEnumerable<KeyValuePair<string, OpenIddictParameter>> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, OpenIddictParameter>> | parameters | The message parameters. |
Remarks
Parameters with a null or empty key are always ignored.
OpenIddictMessage(IEnumerable<KeyValuePair<String, StringValues>>)
Initializes a new OpenIddict message.
Declaration
public OpenIddictMessage(IEnumerable<KeyValuePair<string, StringValues>> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, StringValues>> | parameters | The message parameters. |
Remarks
Parameters with a null or empty key are always ignored.
OpenIddictMessage(IEnumerable<KeyValuePair<String, String[]>>)
Initializes a new OpenIddict message.
Declaration
public OpenIddictMessage(IEnumerable<KeyValuePair<string, string[]>> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.String[]>> | parameters | The message parameters. |
Remarks
Parameters with a null or empty key are always ignored.
OpenIddictMessage(IEnumerable<KeyValuePair<String, String>>)
Initializes a new OpenIddict message.
Declaration
public OpenIddictMessage(IEnumerable<KeyValuePair<string, string>> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.String>> | parameters | The message parameters. |
Remarks
Parameters with a null or empty key are always ignored.
Properties
Count
Gets the number of parameters contained in the current message.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Item[String]
Gets or sets a parameter.
Declaration
public OpenIddictParameter? this[string name] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The parameter name. |
Property Value
Type | Description |
---|---|
System.Nullable<OpenIddictParameter> | The parameter value. |
Parameters
Gets the dictionary containing the parameters.
Declaration
protected Dictionary<string, OpenIddictParameter> Parameters { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, OpenIddictParameter> |
Methods
AddParameter(String, OpenIddictParameter)
Adds a parameter. Note: an exception is thrown if a parameter with the same name was already added.
Declaration
public OpenIddictMessage AddParameter(string name, OpenIddictParameter value)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The parameter name. |
OpenIddictParameter | value | The parameter value. |
Returns
Type | Description |
---|---|
OpenIddictMessage | The current instance, which allows chaining calls. |
GetParameter(String)
Gets the value corresponding to a given parameter.
Declaration
public OpenIddictParameter? GetParameter(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The parameter name. |
Returns
Type | Description |
---|---|
System.Nullable<OpenIddictParameter> | The parameter value, or |
GetParameters()
Gets all the parameters associated with this instance.
Declaration
public IReadOnlyDictionary<string, OpenIddictParameter> GetParameters()
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.String, OpenIddictParameter> | The parameters associated with this instance. |
HasParameter(String)
Determines whether the current message contains the specified parameter.
Declaration
public bool HasParameter(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The parameter name. |
Returns
Type | Description |
---|---|
System.Boolean |
|
RemoveParameter(String)
Removes a parameter.
Declaration
public OpenIddictMessage RemoveParameter(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The parameter name. |
Returns
Type | Description |
---|---|
OpenIddictMessage | The current instance, which allows chaining calls. |
SetParameter(String, Nullable<OpenIddictParameter>)
Adds, replaces or removes a parameter. Note: this method automatically removes empty parameters.
Declaration
public OpenIddictMessage SetParameter(string name, OpenIddictParameter? value)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The parameter name. |
System.Nullable<OpenIddictParameter> | value | The parameter value. |
Returns
Type | Description |
---|---|
OpenIddictMessage | The current instance, which allows chaining calls. |
ToString()
Returns a System.String representation of the current instance that can be used in logs. Note: sensitive parameters like client secrets are automatically removed for security reasons.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | The indented JSON representation corresponding to this message. |
Overrides
TryGetParameter(String, out OpenIddictParameter)
Tries to get the value corresponding to a given parameter.
Declaration
public bool TryGetParameter(string name, out OpenIddictParameter value)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The parameter name. |
OpenIddictParameter | value | The parameter value. |
Returns
Type | Description |
---|---|
System.Boolean |
|
WriteTo(Utf8JsonWriter)
Writes the message to the specified JSON writer.
Declaration
public void WriteTo(Utf8JsonWriter writer)
Parameters
Type | Name | Description |
---|---|---|
Utf8JsonWriter | writer | The UTF-8 JSON writer. |