Skip to content

Commit 1216180

Browse files
committed
Additional extensions
1 parent 8e46060 commit 1216180

File tree

4 files changed

+90
-2
lines changed

4 files changed

+90
-2
lines changed

v3/cred.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,37 @@ type Credential interface {
100100
// - err: error if one occurred, otherwise nil
101101
InquireByMech(mech GssMech) (info *CredInfo, err error) // RFC 2743 § 2.1.5
102102
}
103+
104+
// CredentialExtRFC4178 extends the Credential interface to support the APIs defined in RFC 4178: GSSAPI Negotiation mechanism.
105+
type CredentialExtRFC4178 interface {
106+
Credential
107+
SetNegotiationMechs([]GssMech) error // RFC 4178 § B.1
108+
GetNegotiationMechs() ([]GssMech, error) // RFC 4178 § B.2
109+
}
110+
111+
// CredentialExtRFC5588 extends the Credential interface to support the APIs defined in RFC 5588: GSSAPI Negotiation mechanismStoring delegated credentials.
112+
type CredentialExtRFC5588 interface {
113+
Credential
114+
StoreCredential(usage CredUsage, mech GssMech, overwrite bool, makeDefault bool) ([]GssMech, CredUsage, error) // RFC 5588 § B.1
115+
}
116+
117+
// CredentialExtGGF extends the Credential interface to support the APIs defined in GFD.24: GGF extensions.
118+
type CredentialExtGGF interface {
119+
Credential
120+
Export() ([]byte, error) // GFD.24 § 2.1.1
121+
InquireByOid(oid Oid) (data [][]byte, err error) // GFD.24 § 2.3.2
122+
123+
}
124+
125+
// CredentialExtS4U extends the Credential interface to support the APIs defined in S4U extensions.
126+
type CredentialExtS4U interface {
127+
Credential
128+
AquireImpersonateName(name GssName, mechs []GssMech, usage CredUsage, lifetime time.Duration) (Credential, error)
129+
AddImpersonateName(impersonateCred Credential, name GssName, mech GssMech, usage CredUsage, initiatorLifetime time.Duration, acceptorLifetime time.Duration) (Credential, error)
130+
}
131+
132+
// Acquire credentials with password extension
133+
type CredentialExtCredPassword interface {
134+
Credential
135+
AddWithPassword(name GssName, password string, mech GssMech, usage CredUsage, initiatorLifetime time.Duration, acceptorLifetime time.Duration) (Credential, error)
136+
}

v3/extensions.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,24 @@ const (
1313
// HasExtChannelBindingSignalling indicates support for channel binding signalling extensions
1414
// (https://datatracker.ietf.org/doc/html/draft-williams-kitten-channel-bound-flag-02)
1515
HasExtChannelBindingSignalling GssapiExtension = iota
16-
// HasExtInquireSecContextByOid indicates support for context inquiry by OID (GDF: https://ogf.org/documents/GFD.24.pdf)
17-
HasExtInquireSecContextByOid
1816
// HasExtLocalname indicates support for local name mapping extensions (Solaris-style)
1917
HasExtLocalname
18+
// HasExtRFC4178 indicates support for the credential APIs defined in RFC 4178: GSSAPI Negotiation mechamisn
19+
HasExtRFC4178
20+
// HasExtRFC5588 indicates support for the credential APIs defined in RFC 5588: Storing delegated credentials
21+
HasExtRFC5588
2022
// HasExtRFC6680 indicates support for RFC 6680 naming extensions (composite names and attributes)
2123
HasExtRFC6680
2224
// HasExtRFC5587 indicates support for RFC 5587 mechanism inquiry extensions (mechanism attributes)
2325
HasExtRFC5587
26+
// HasExtRFC5801 indicates support for RFC 5801 Mechanisms in SASL Negotiation
27+
HasExtRFC5801
28+
// HasExtRFC4121 indicates support for RFC 4121: AEAD modes for Kerberos GSSAPI
29+
HasExtRFC4121
30+
// HasExtGGF indicates support for GGF extensions (GDF: https://ogf.org/documents/GFD.24.pdf)
31+
HasExtGGF
32+
// HasS4U indicates support for Service4user constrained delegation extensions
33+
HasS4U
34+
// HasExtCredPassword indicates support for acquiring credentials using passwords
35+
HasExtCredPassword
2436
)

v3/provider.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,33 @@ type ProviderExtRFC5587 interface {
262262
// The three parameters represent desired attributes, except attributes, and critical attributes respectively.
263263
IndicateMechsByAttrs([]GssMechAttr, []GssMechAttr, []GssMechAttr) ([]GssMech, error) // RFC 5587 § 3.4.2
264264
}
265+
266+
// ProviderExtRFC5801 extends the Provider interface with RFC 5801 mechanism functionality.
267+
// Providers implementing this interface can be used by GS2 SASL mechanisms. Support
268+
// for RFC 5801 can be determined with a call to `HasExtension(HasExtRFC5801)`.
269+
type ProviderExtRFC5801 interface {
270+
Provider
271+
// InquireSASLNameForMech identified the GSSAPI mechanism to which a SASL mechanism refers
272+
// See RFC 5801 § 10
273+
InquireSASLNameForMech(m GssMech) (SASLMechInfo, error)
274+
// InquireMechForSASLName identifies the SASL mechanism to which a GSSAPI mechanism refers
275+
// See RFC 5801 § 11
276+
InquireMechForSASLName(saslName string) (GssMech, error)
277+
}
278+
279+
type SASLMechInfo struct {
280+
SASLName string
281+
MechName string
282+
MechDescription string
283+
}
284+
285+
type ProviderExtGGF interface {
286+
Provider
287+
ImportCredential(b []byte) (Credential, error) // GFD.24 § 2.1.2
288+
}
289+
290+
// Acquire credentials with password extension
291+
type ProviderExtCredPassword interface {
292+
Provider
293+
AcquireCredentialWithPassword(name GssName, password string, lifetime time.Duration, mechs []GssMech, usage CredUsage) (Credential, error)
294+
}

v3/seccontext.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,15 @@ type SecContext interface {
182182
// - err: Error if one occurred, otherwise nil
183183
Continue([]byte) (tokOut []byte, err error)
184184
}
185+
186+
type SecContextExtGGF interface {
187+
SecContext
188+
InquireByOid(oid Oid) (data [][]byte, err error) // GFD.24 § 2.3.1
189+
SetOption(option Oid, value []byte) error // GFD.24 § 2.4.1
190+
}
191+
192+
type SecContextExtRFC4121 interface {
193+
SecContext
194+
WrapAEAD([]byte, []byte, bool, QoP) (msgOut []byte, confState bool, err error) // RFC 4121 § 4.1
195+
UnwrapAEAD([]byte, []byte) (msgOut []byte, confState bool, err error) // RFC 4121 § 4.2
196+
}

0 commit comments

Comments
 (0)