func lockUserNhName(ctx *context.T) string { var ( principal = v23.GetPrincipal(ctx) blessings, _ = principal.BlessingStore().Default() bNames = security.BlessingNames(principal, blessings) ) return lockUserNhPrefix + vUser(bNames...) }
func isKeyValidForLock(ctx *context.T, key security.Blessings, lockName string) bool { bp := security.BlessingPattern(lockName + security.ChainSeparator + "key") for _, b := range security.BlessingNames(v23.GetPrincipal(ctx), key) { if bp.MatchedBy(b) { return true } } return false }
//export Java_io_v_v23_security_VSecurity_nativeGetBlessingNames func Java_io_v_v23_security_VSecurity_nativeGetBlessingNames(jenv *C.JNIEnv, jVSecurityClass C.jclass, jPrincipal C.jobject, jBlessings C.jobject) C.jobjectArray { env := jutil.Env(uintptr(unsafe.Pointer(jenv))) principal, err := GoPrincipal(env, jutil.Object(uintptr(unsafe.Pointer(jPrincipal)))) if err != nil { jutil.JThrowV(env, err) } blessings, err := GoBlessings(env, jutil.Object(uintptr(unsafe.Pointer(jBlessings)))) if err != nil { jutil.JThrowV(env, err) return nil } blessingStrs := security.BlessingNames(principal, blessings) jArr, err := jutil.JStringArray(env, blessingStrs) if err != nil { jutil.JThrowV(env, err) return nil } return C.jobjectArray(unsafe.Pointer(jArr)) }