Expose AuthContext in C##9632
Conversation
a74b8ff to
ada5104
Compare
|
@apolcyn this should be ready for review. |
There was a problem hiding this comment.
nit: extra blank line here
There was a problem hiding this comment.
nit: s/"string of value"/"string value"
There was a problem hiding this comment.
nit: s/"and instance"/"an instance"`
There was a problem hiding this comment.
nit: IMO only but maybe simpler as:
if (!propertiesDict.ContainsKey(authProperty.Name))
{
propertiesDict[authProperty.Name] = new List<AuthProperty>();
}
propertiesDict[authProperty.Name].Add(authProperty);
There was a problem hiding this comment.
small wording nits on summary comments. s/a/an
ada5104 to
31cf5b2
Compare
jtattermusch
left a comment
There was a problem hiding this comment.
comments addressed.
apolcyn
left a comment
There was a problem hiding this comment.
comments I accidentally left out - I think. sorry ignore if already saw these
There was a problem hiding this comment.
always safe to assume the value read out is UTF8 encoded?
There was a problem hiding this comment.
nit: for comment, 'Gets the string value of the property as a UTF8 decoding of the value's bytes.' ?
There was a problem hiding this comment.
To me that's an implementation detail. Normally, the auth property will be created by gRPC and users will just read string values and from that perspective, the original encoding is not really important.
There was a problem hiding this comment.
since it looks like AuthProperty only created within grpc and passed up to the app, does the Create method here need to be exposed?
There was a problem hiding this comment.
It is useful for testing, otherwise there is no way for the users to create instances of AuthProperty.
There was a problem hiding this comment.
For that, need the public constructor for AuthContext too?
There was a problem hiding this comment.
I'd better not expose the public constructor for AuthContext for now. Once a constructor is published, it's hard to change the internals of the auth context if changes are necessary. We can later add the constructor once the existing implementation proves to be working well for people.
There was a problem hiding this comment.
nit: for comment, 'Gets the string value of the property as a UTF8 decoding of the value's bytes.' ?
There was a problem hiding this comment.
more idiomatic to use the Enumerable<AuthProperty>?
one thought on API is it seems AuthContext could be more like a dictionary.
basically Dictionary<string, List<Property>> could be more like Dictionary<string, List<Value>>?
There was a problem hiding this comment.
yeah, ideally properties should be a read only multi-map, but unfortunately C# libraries don't have a type for multimap nor they have the right type that would allow use to preserve immutability. So what I'm exposing is my best attempt to make the API clear and preserve all the properties I want it to have.
There was a problem hiding this comment.
For that, need the public constructor for AuthContext too?
31cf5b2 to
c9f33d2
Compare
c9f33d2 to
c9b03fe
Compare
|
I believe I've addressed/answered all comments. PTAL. |
|
@dgquintas FYI I'd like to merge this one before cutting the 1.2.x release branch (I need a final LGTM) |
|
@jtattermusch in that case add the "release blocker" label |
Expose C core's auth context in C#, ready for initial review.
@jboeuf for general sanity
@apolcyn for C#
@nathanielmanistaatgoogle FYI