#### [Abblix\.Utils](https://www.abblix.com/en/docs/api/abblix-utils 'index')
### [Abblix\.Utils](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils 'Abblix\.Utils')

## WwwAuthenticate Class

Builds `WWW-Authenticate` challenge values: the HTTP grammar, not any one protocol's
vocabulary of errors\.

```csharp
public static class WwwAuthenticate
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → WwwAuthenticate

### Remarks
Two packages emit these headers for two different error vocabularies \- an authorization server
answering with OpenID Connect errors, and a Shared Signals transmitter answering with the three
RFC 6750 codes \- and they cannot share a type that names either\. What they do share is the quoted\-string
grammar and the rule about when a challenge stays bare, which is what lives here\.
### Methods

## WwwAuthenticate\.Challenge\(string, string\) Method {#Abblix.Utils.WwwAuthenticate.Challenge(string,string)}

A challenge advertising [scheme](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.WwwAuthenticate#Abblix.Utils.WwwAuthenticate.Challenge(string,string).scheme 'Abblix\.Utils\.WwwAuthenticate\.Challenge\(string, string\)\.scheme') and nothing else beyond the realm\.

```csharp
public static string Challenge(string scheme, string? realm=null);
```
#### Parameters

###### `scheme` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Utils.WwwAuthenticate.Challenge(string,string).scheme}

###### `realm` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Utils.WwwAuthenticate.Challenge(string,string).realm}

#### Returns
[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')

### Remarks
This is the form RFC 6750 Section 3\.1 requires when the request carried no credentials at all:
"If the request lacks any authentication information \(e\.g\., the client was unaware that
authentication is necessary or attempted using an unsupported authentication method\), the resource
server SHOULD NOT include an error code or other error information\." A caller that has not tried
yet has nothing to correct, and naming an error would describe a failure that did not happen\.

## WwwAuthenticate\.Challenge\(string, string, string, string\) Method {#Abblix.Utils.WwwAuthenticate.Challenge(string,string,string,string)}

A challenge naming why the credentials that WERE presented did not suffice\.

```csharp
public static string Challenge(string scheme, string? realm, string error, string? errorDescription);
```
#### Parameters

###### `scheme` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Utils.WwwAuthenticate.Challenge(string,string,string,string).scheme}

The authentication scheme, such as `Bearer`\.

###### `realm` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Utils.WwwAuthenticate.Challenge(string,string,string,string).realm}

The protection space, omitted when null or empty\.

###### `error` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Utils.WwwAuthenticate.Challenge(string,string,string,string).error}

The error code, from whatever vocabulary the scheme defines\.

###### `errorDescription` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Utils.WwwAuthenticate.Challenge(string,string,string,string).errorDescription}

Human\-readable detail, omitted when null or empty\.

#### Returns
[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')
