# flytekit.models.security

## Directory

### Classes

| Class | Description |
|-|-|
| [`Identity`](https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.models.security/page.md#flytekitmodelssecurityidentity) |  |
| [`OAuth2Client`](https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.models.security/page.md#flytekitmodelssecurityoauth2client) |  |
| [`OAuth2TokenRequest`](https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.models.security/page.md#flytekitmodelssecurityoauth2tokenrequest) |  |
| [`Secret`](https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.models.security/page.md#flytekitmodelssecuritysecret) | See :std:ref:`cookbook:secrets` for usage examples. |
| [`SecurityContext`](https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.models.security/page.md#flytekitmodelssecuritysecuritycontext) | This is a higher level wrapper object that for the most part users shouldn't have to worry about. |

## flytekit.models.security.Identity

### Parameters

```python
class Identity(
    iam_role: typing.Optional[str],
    k8s_service_account: typing.Optional[str],
    oauth2_client: typing.Optional[flytekit.models.security.OAuth2Client],
    execution_identity: typing.Optional[str],
)
```
| Parameter | Type | Description |
|-|-|-|
| `iam_role` | `typing.Optional[str]` | |
| `k8s_service_account` | `typing.Optional[str]` | |
| `oauth2_client` | `typing.Optional[flytekit.models.security.OAuth2Client]` | |
| `execution_identity` | `typing.Optional[str]` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `is_empty` | `None` |  |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    pb2_object: flyteidl.core.security_pb2.Identity,
) -> Identity
```
| Parameter | Type | Description |
|-|-|-|
| `pb2_object` | `flyteidl.core.security_pb2.Identity` | |

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
## flytekit.models.security.OAuth2Client

### Parameters

```python
class OAuth2Client(
    client_id: str,
    client_secret: str,
)
```
| Parameter | Type | Description |
|-|-|-|
| `client_id` | `str` | |
| `client_secret` | `str` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `is_empty` | `None` |  |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    pb2_object: flyteidl.core.security_pb2.OAuth2Client,
) -> OAuth2Client
```
| Parameter | Type | Description |
|-|-|-|
| `pb2_object` | `flyteidl.core.security_pb2.OAuth2Client` | |

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
## flytekit.models.security.OAuth2TokenRequest

### Parameters

```python
class OAuth2TokenRequest(
    name: str,
    client: flytekit.models.security.OAuth2Client,
    idp_discovery_endpoint: typing.Optional[str],
    token_endpoint: typing.Optional[str],
    type_: <enum 'Type'>,
)
```
| Parameter | Type | Description |
|-|-|-|
| `name` | `str` | |
| `client` | `flytekit.models.security.OAuth2Client` | |
| `idp_discovery_endpoint` | `typing.Optional[str]` | |
| `token_endpoint` | `typing.Optional[str]` | |
| `type_` | `<enum 'Type'>` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `is_empty` | `None` |  |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    pb2_object: flyteidl.core.security_pb2.OAuth2TokenRequest,
) -> OAuth2TokenRequest
```
| Parameter | Type | Description |
|-|-|-|
| `pb2_object` | `flyteidl.core.security_pb2.OAuth2TokenRequest` | |

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
## flytekit.models.security.Secret

See :std:ref:`cookbook:secrets` for usage examples.

### Parameters

```python
class Secret(
    group: typing.Optional[str],
    key: typing.Optional[str],
    group_version: typing.Optional[str],
    mount_requirement: <enum 'MountType'>,
    env_var: typing.Optional[str],
)
```
| Parameter | Type | Description |
|-|-|-|
| `group` | `typing.Optional[str]` | |
| `key` | `typing.Optional[str]` | |
| `group_version` | `typing.Optional[str]` | |
| `mount_requirement` | `<enum 'MountType'>` | |
| `env_var` | `typing.Optional[str]` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `is_empty` | `None` |  |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    pb2_object: flyteidl.core.security_pb2.Secret,
) -> Secret
```
| Parameter | Type | Description |
|-|-|-|
| `pb2_object` | `flyteidl.core.security_pb2.Secret` | |

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
## flytekit.models.security.SecurityContext

This is a higher level wrapper object that for the most part users shouldn't have to worry about. You should
be able to just use {{&lt; py_class_ref flytekit.Secret &gt;}} instead.

### Parameters

```python
class SecurityContext(
    run_as: typing.Optional[flytekit.models.security.Identity],
    secrets: typing.Optional[typing.List[flytekit.models.security.Secret]],
    tokens: typing.Optional[typing.List[flytekit.models.security.OAuth2TokenRequest]],
)
```
| Parameter | Type | Description |
|-|-|-|
| `run_as` | `typing.Optional[flytekit.models.security.Identity]` | |
| `secrets` | `typing.Optional[typing.List[flytekit.models.security.Secret]]` | |
| `tokens` | `typing.Optional[typing.List[flytekit.models.security.OAuth2TokenRequest]]` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `is_empty` | `None` |  |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    pb2_object: flyteidl.core.security_pb2.SecurityContext,
) -> SecurityContext
```
| Parameter | Type | Description |
|-|-|-|
| `pb2_object` | `flyteidl.core.security_pb2.SecurityContext` | |

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/flytekit-sdk/packages/flytekit.models.security.md
**HTML**: https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.models.security/
