veyron2/security: Replace PrincipalPattern with BlessingPattern.
This change:
(1) Renames PrincipalPattern to BlessingPattern
(2) Changes the MatchedBy method to operate on blessing strings instead of
requiring the PublicID.
(3) Updates ACL matching to use simpler primitives
This is step one of many in morphing the security API/model to
the target state described in:
https://veyron-review.googlesource.com/#/c/4102/
TESTED=go test veyron/... veyron2/... on mac and linux
And ran all the shell tests on Mac.
Change-Id: I810b3c8b2e3b4e93a1e951a594601bc9e1f4c05f
diff --git a/jni/runtimes/google/security/publicid_store.go b/jni/runtimes/google/security/publicid_store.go
index 2c5237b..04334f5 100644
--- a/jni/runtimes/google/security/publicid_store.go
+++ b/jni/runtimes/google/security/publicid_store.go
@@ -54,14 +54,14 @@
jPublicIDStore C.jobject
}
-func (s *publicIDStore) Add(id security.PublicID, peerPattern security.PrincipalPattern) error {
+func (s *publicIDStore) Add(id security.PublicID, peerPattern security.BlessingPattern) error {
envPtr, freeFunc := util.GetEnv(s.jVM)
env := (*C.JNIEnv)(envPtr)
defer freeFunc()
util.GoRef(&id) // Un-refed when the Java PublicID object created below is finalized.
jPublicID := C.jobject(util.NewObjectOrCatch(env, jPublicIDImplClass, []util.Sign{util.LongSign}, &id))
- jPrincipalPattern := C.jobject(util.NewObjectOrCatch(env, jPrincipalPatternClass, []util.Sign{util.StringSign}, string(peerPattern)))
- return util.CallVoidMethod(env, s.jPublicIDStore, "add", []util.Sign{publicIDSign, principalPatternSign}, jPublicID, jPrincipalPattern)
+ jBlessingPattern := C.jobject(util.NewObjectOrCatch(env, jBlessingPatternClass, []util.Sign{util.StringSign}, string(peerPattern)))
+ return util.CallVoidMethod(env, s.jPublicIDStore, "add", []util.Sign{publicIDSign, principalPatternSign}, jPublicID, jBlessingPattern)
}
func (s *publicIDStore) ForPeer(peer security.PublicID) (security.PublicID, error) {
@@ -90,10 +90,10 @@
return (*(*security.PublicID)(util.Ptr(publicIDPtr))), nil
}
-func (s *publicIDStore) SetDefaultPrincipalPattern(pattern security.PrincipalPattern) error {
+func (s *publicIDStore) SetDefaultBlessingPattern(pattern security.BlessingPattern) error {
envPtr, freeFunc := util.GetEnv(s.jVM)
env := (*C.JNIEnv)(envPtr)
defer freeFunc()
- jPattern := C.jobject(util.NewObjectOrCatch(env, jPrincipalPatternClass, []util.Sign{util.StringSign}, string(pattern)))
- return util.CallVoidMethod(env, s.jPublicIDStore, "setDefaultPrincipalPattern", []util.Sign{principalPatternSign}, jPattern)
+ jPattern := C.jobject(util.NewObjectOrCatch(env, jBlessingPatternClass, []util.Sign{util.StringSign}, string(pattern)))
+ return util.CallVoidMethod(env, s.jPublicIDStore, "setDefaultBlessingPattern", []util.Sign{principalPatternSign}, jPattern)
}