(
headers: Dict[str, str], query_params: Dict[str, List[str]], option: Any
)
| 83 | |
| 84 | |
| 85 | def _parse_security_option( |
| 86 | headers: Dict[str, str], query_params: Dict[str, List[str]], option: Any |
| 87 | ): |
| 88 | if not isinstance(option, BaseModel): |
| 89 | raise TypeError("security option must be a pydantic model") |
| 90 | |
| 91 | opt_fields: Dict[str, FieldInfo] = option.__class__.model_fields |
| 92 | |
| 93 | for name in opt_fields: |
| 94 | opt_field = opt_fields[name] |
| 95 | |
| 96 | metadata = find_field_metadata(opt_field, SecurityMetadata) |
| 97 | if metadata is None or not metadata.scheme: |
| 98 | continue |
| 99 | |
| 100 | value = getattr(option, name) |
| 101 | if ( |
| 102 | metadata.scheme_type == "http" |
| 103 | and metadata.sub_type == "basic" |
| 104 | and not isinstance(value, BaseModel) |
| 105 | ): |
| 106 | _parse_basic_auth_scheme(headers, option) |
| 107 | return |
| 108 | |
| 109 | _parse_security_scheme(headers, query_params, metadata, name, value) |
| 110 | |
| 111 | |
| 112 | def _parse_security_scheme( |
no test coverage detected