# Google API Common Protos Client - Class AuthenticationRule (4.14.0)

4.14.0 (latest) 4.13.0 4.12.5 4.11.0 4.10.0 4.9.0 4.8.3 Reference documentation and code samples for the Google API Common Protos Client class AuthenticationRule.

Authentication rules for the service.

By default, if a method has any authentication requirements, every request
must include a valid credential matching one of the requirements.
It's an error to include more than one kind of credential in a single
request.
If a method doesn't have any auth requirements, request credentials will be
ignored.

Generated from protobuf message `google.api.AuthenticationRule`

## Namespace

Google \\ Api

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ selector` | `string` Selects the methods to which this rule applies. Refer to [selector](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.DocumentationRule#_Google_Api_DocumentationRule__getSelector__) for syntax details. |
| `↳ oauth` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.OAuthRequirements` The requirements for OAuth credentials. |
| `↳ allow_without_credential` | `bool` If true, the service accepts API keys without any other credential. This flag only applies to HTTP and gRPC requests. |
| `↳ requirements` | `array<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.AuthRequirement>` Requirements for additional authentication providers. |

### getSelector

Selects the methods to which this rule applies.

Refer to [selector](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.DocumentationRule#_Google_Api_DocumentationRule__getSelector__) for syntax
details.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setSelector

Selects the methods to which this rule applies.

Refer to [selector](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.DocumentationRule#_Google_Api_DocumentationRule__getSelector__) for syntax
details.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getOauth

The requirements for OAuth credentials.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.OAuthRequirements|null` |   |

### hasOauth

### clearOauth

### setOauth

The requirements for OAuth credentials.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.OAuthRequirements` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAllowWithoutCredential

If true, the service accepts API keys without any other credential.

This flag only applies to HTTP and gRPC requests.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setAllowWithoutCredential

If true, the service accepts API keys without any other credential.

This flag only applies to HTTP and gRPC requests.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRequirements

Requirements for additional authentication providers.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.AuthRequirement>` |   |

### setRequirements

Requirements for additional authentication providers.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.AuthRequirement>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |