Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
ext_rfc6680.pyi170 linesDownload Raw Back to raw
1import typing as t2 3if t.TYPE_CHECKING:4    from gssapi.raw.named_tuples import (5        GetNameAttributeResult,6        InquireNameResult,7    )8    from gssapi.raw.names import Name9    from gssapi.raw.oids import OID10 11 12def display_name_ext(13    name: "Name",14    name_type: "OID",15) -> bytes:16    """Display the given Name using the given name type.17 18    This method attempts to display the given Name using the syntax of19    the given name type.  If this is not possible, an appropriate error20    will be raised.21 22    Args:23        name (~gssapi.raw.names.Name): the name to display24        name_type (~gssapi.OID): the name type (see NameType) to use to25            display the given name26 27    Returns:28        bytes: the displayed name29 30    Raises:31        ~gssapi.exceptions.OperationUnavailableError: the given name could not32            be displayed using the given name type33    """34 35 36def inquire_name(37    name: "Name",38    mech_name: bool = True,39    attrs: bool = True,40) -> "InquireNameResult":41    """Get information about a Name.42 43    This method retrieves information about the given name, including44    the set of attribute names for the given name, as well as whether or45    not the name is a mechanism name.  Additionally, if the given name is46    a mechanism name, the associated mechansim is returned as well.47 48    Args:49        name (~gssapi.raw.names.Name): the name about which to inquire50        mech_name (bool): whether or not to retrieve if this name51            is a mech_name (and the associate mechanism)52        attrs (bool): whether or not to retrieve the attribute name list53 54    Returns:55        InquireNameResult: the set of attribute names for the given name,56        whether or not the name is a Mechanism Name, and potentially57        the associated mechanism if it is a Mechanism Name58 59    Raises:60        ~gssapi.exceptions.GSSError61    """62 63 64def set_name_attribute(65    name: "Name",66    attr: bytes,67    value: t.Iterable[bytes],68    complete: bool = False,69) -> None:70    """Set the value(s) of a name attribute.71 72    This method sets the value(s) of the given attribute on the given name.73 74    Note that this functionality more closely matches the pseudo-API75    presented in RFC 6680, not the C API (which uses multiple calls to76    add multiple values).  However, multiple calls to this method will77    continue adding values, so :func:`delete_name_attribute` must be78    used in between calls to "clear" the values.79 80    Args:81        name (~gssapi.raw.names.Name): the Name on which to set the attribute82        attr (bytes): the name of the attribute83        value (list): a list of bytes objects to use as the value(s)84        complete (bool): whether or not to mark this attribute's value85            set as being "complete"86 87    Raises:88        ~gssapi.exceptions.OperationUnavailableError: the given attribute name89            is unknown or could not be set90    """91 92 93def get_name_attribute(94    name: "Name",95    attr: bytes,96    more: t.Optional[int] = None,97) -> "GetNameAttributeResult":98    """Get the value(s) of a name attribute.99 100    This method retrieves the value(s) of the given attribute101    for the given Name.102 103    Note that this functionality matches pseudo-API presented104    in RFC 6680, not the C API (which uses a state variable and105    multiple calls to retrieve multiple values).106 107    Args:108        name (~gssapi.raw.names.Name): the Name from which to get the attribute109        attr (bytes): the name of the attribute110 111    Returns:112        GetNameAttributeResult: the raw version of the value(s),113        the human-readable version of the value(s), whether114        or not the attribute was authenticated, and whether or115        not the attribute's value set was marked as complete116 117    Raises:118        ~gssapi.exceptions.OperationUnavailableError: the given attribute is119            unknown or unset120    """121 122 123def delete_name_attribute(124    name: "Name",125    attr: bytes,126) -> None:127    """Remove an attribute from a name.128 129    This method removes an attribute from a Name.  This method may be130    used before :func:`set_name_attribute` clear the values of an attribute131    before setting a new value (making the latter method work like a 'set'132    operation instead of an 'add' operation).133 134    Note that the removal of certain attributes may not be allowed.135 136    Args:137        name (~gssapi.raw.names.Name): the name to remove the attribute from138        attr (bytes): the name of the attribute139 140    Raises:141        ~gssapi.exceptions.OperationUnavailableError142        ~gssapi.exceptions.UnauthorizedError143    """144 145 146def export_name_composite(147    name: "Name",148) -> bytes:149    """Export a name, preserving attribute information.150 151    This method functions similarly to :func:`~gssapi.raw.names.export_name`,152    except that it preserves attribute information.  The resulting bytes may be153    imported using :func:`~gssapi.raw.names.import_name` with the154    :attr:`~gssapi.raw.types.NameType.composite_export` name type.155 156    Note:157        Some versions of MIT Kerberos require you to either canonicalize a name158        once it has been imported with composite-export name type, or to import159        using the normal export name type.160 161    Args:162        name (~gssapi.raw.names.Name): the name to export163 164    Returns:165        bytes: the exported composite name166 167    Raises:168        ~gssapi.exceptions.GSSError169    """170 
codekingpro/portable-devtools · Team Ai