Get KRB5/GSS status in Swift

227 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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);
    }
});