yohcop / openid-go

OpenID consumer implementation in Go - golang
Other
83 stars 40 forks source link

discovery-cache #34

Closed qzaidi closed 8 years ago

qzaidi commented 8 years ago

Hi,

Can you explain how to use the discovery cache. I see that the cache is not at all used, because while there is a Get in verify.go, there is no Put in the code anywhere. Am I supposed to do the Put myself?

In verify.go - control goes to and discovered is always nil 168 discovered := cache.Get(endpoint) Then it returns from this block, but I don't see cache.Put anywhere in code. 197 if ep == endpoint { Are we supposed to Put the discovered url at this point, or do this externally? An example will help greatly. I am sorry if the question is unclear, and i haven't fully understood the code or protocol, so it may be my flawed understanding, apologies in advance.

xStrom commented 8 years ago

From what I've gathered the Put call is currently missing from the library code. I haven't had the time yet to analyse the spec properly in order to submit a pull request. However it's on my todo list and I hope to get this done sometime during this week.

So you can probably use the library under the assumption that the discovery cache is updated by the library.

yohcop commented 8 years ago

Hi, Yeah, the specs aren't really clear as to when put things in the cache, but they say something like "if [this] has not been previously discovered", implying the use of a cache.

Like xStorm said, you can use it assuming the library is updating it. When this is fixed, the library should update the cache for you.

yohcop commented 8 years ago

As you can see @xStrom implemented this now, so closing this issue. Thanks for pointing that out!