mhurron
mhurron

Reputation: 73

Get KRB5/GSS status in Swift

In Swift, how do I get the status of a users kerberos ticket? I see the GSS library at https://developer.apple.com/reference/gss but there is absolutely no documentation beyond 'it exists with these function names.'

From the name, it seems like func GSSCredentialGetLifetime(_ cred: gss_cred_id_t) -> OM_uint32 would be what I want to use, but where do I get a variable of the type gss_cred_id_t to pass into that function?

Upvotes: 1

Views: 268

Answers (1)

dadalar
dadalar

Reputation: 644

You can iterate over the credentials (Kerberos tickets) to get gss_cred_id_t. For example:

gss_iter_creds(&min_stat, 0, NULL, ^(gss_OID oid, gss_cred_id_t gcred) {
    if (gcred) {
        OM_uint32 lifetime = GSSCredentialGetLifetime(cred);
        NSLog(@"Lifetime: %d", lifetime);
    }
});

Upvotes: 0

Related Questions