File: names.pyi

package info (click to toggle)
python-gssapi 1.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 876 kB
  • sloc: python: 3,707; sh: 198; makefile: 154; ansic: 60
file content (170 lines) | stat: -rw-r--r-- 4,109 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import typing as t

if t.TYPE_CHECKING:
    from gssapi.raw.named_tuples import DisplayNameResult
    from gssapi.raw.oids import OID

class Name:
    """
    A GSSAPI Name
    """

    def __new__(
        cls,
        cpy: t.Optional["Name"] = None,
    ) -> "Name": ...


def import_name(
    name: bytes,
    name_type: t.Optional["OID"] = None,
) -> Name:
    """Convert a string and a name type into a GSSAPI name.

    This method takes a string name and a name type and converts
    them into a GSSAPI :class:`Name`.

    Args:
        name (~gssapi.raw.names.Name): the string version of the name
        name_type (~gssapi.raw.types.MechType): the type of this name

    Returns:
        Name: the GSSAPI version of the name

    Raises:
        ~gssapi.exceptions.BadNameTypeError
        ~gssapi.exceptions.BadNameError
        ~gssapi.exceptions.BadMechanismError
    """


def display_name(
    name: Name,
    name_type: bool = True,
) -> "DisplayNameResult":
    """Convert a GSSAPI name into its components.

    This method converts a GSSAPI :class:`Name` back into its
    text form.  If ``name_type`` is True, it also attempts to
    retrieve the :class:`~gssapi.raw.types.NameType` of the name (otherwise the
    returned name type will be ``None``).

    Args:
        name (~gssapi.raw.names.Name): the name in question
        name_type (~gssapi.raw.types.MechType): whether or not to retrieve the
            name type

    Returns:
        DisplayNameResult: the text part of the name and its type

    Raises:
        ~gssapi.exceptions.BadNameError
    """


def compare_name(
    name1: Name,
    name2: Name,
) -> bool:
    """Check two GSSAPI names to see if they are the same.

    This method compares two GSSAPI names, checking to
    see if they are equivalent.

    Args:
        name1 (~gssapi.raw.names.Name): the first name to compare
        name2 (~gssapi.raw.names.Name): the second name to compare

    Returns:
        bool: whether or not the names are equal

    Raises:
        ~gssapi.exceptions.BadNameTypeError
        ~gssapi.exceptions.BadNameError
    """


def export_name(
    name: Name,
) -> bytes:
    """Export a GSSAPI name.

    This method "produces a canonical contigous string representation
    of a mechanism name, suitable for direct comparison for use in
    authorization functions".

    The input name must be a valid GSSAPI mechanism name, as generated by
    :func:`canonicalize_name` or
    :func:`~gssapi.raw.sec_contexts.accept_sec_context`.

    Args:
        name (~gssapi.raw.names.Name): the name to export

    Returns:
        bytes: the exported name

    Raises:
        ~gssapi.exceptions.MechanismNameRequiredError
        ~gssapi.exceptions.BadNameTypeError
        ~gssapi.exceptions.BadNameError
    """


def canonicalize_name(
    name: Name,
    mech: "OID",
) -> Name:
    """Canonicalize an arbitrary GSSAPI Name into a Mechanism Name

    This method turns any GSSAPI name into a "mechanism name" --
    a full form name specific to a mechanism.

    Args:
        name (~gssapi.raw.names.Name): the name to canonicalize
        mech (~gssapi.raw.types.MechType): the mechanism type to use to
            canonicalize the name

    Returns:
        Name: a canonicalized version of the input name

    Raises:
        ~gssapi.exceptions.BadMechanismError
        ~gssapi.exceptions.BadNameTypeError
        ~gssapi.exceptions.BadNameError
    """


def duplicate_name(
    name: Name,
) -> Name:
    """Duplicate a GSSAPI name.

    Args:
        name (~gssapi.raw.names.Name): the name to duplicate

    Returns:
        Name: a duplicate of the input name

    Raises:
        ~gssapi.exceptions.BadNameError
    """


def release_name(
    name: Name,
) -> None:
    """Release a GSSAPI name.

    This method frees a GSSAPI :class:`Name`.
    You probably won't have to do this.

    Warning:
        This method is deprecated.  Names are
        automatically freed by Python.

    Args:
        name (~gssapi.raw.names.Name): the name in question

    Raises:
        ~gssapi.exceptions.BadNameError
    """