User authentication with AuthBoss - Storer problem

blov · · 941 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi <a href="/r/golang" rel="nofollow">r/golang</a>, I am new to Go and currently trying to do implement user authentication for my web.</p> <p>I came across AuthBoss and I found it to be a comprehensive user auth library which suits my needs well.</p> <p>However when I read through the codes, the &#34;Storer&#34; made me confused.</p> <p>I just want make a simple &#34;Register / Login / Logout / Posting&#34; system which works with traditional database, but the doc says </p> <blockquote> <p>Authboss makes no presumptions about how you want to store your data.</p> </blockquote> <p>and I don&#39;t know how to implement it with an SQL database. </p> <p>Any opensource example for this? Do Gophers usually work with databases or do they have other common approach?</p> <hr/>**评论:**<br/><br/>aarondl: <pre><p>Hey there. I&#39;m the Author of this library. First off I want to make sure you&#39;re using v2 of the library. Check which branch you&#39;re using, it should be the v2 branch (the master branch Readme mentions this). Secondly reddit isn&#39;t the place for asking questions about a specific library. On our Readme there&#39;s a mailing list (Google groups) that you can use or you could open a github issue to talk to us directly about problems.</p> <p>In v2 the ServerStorer (which replaces the v1 storer) is a lot more obvious how to implement. Both of them however can easily be implemented with an sql database. Try that out and post on github/mailing list if you still run into problems. Thanks for trying out Authboss :) </p></pre>hinsxd: <pre><p>Oh I don&#39;t expect authors to appear in my post, what a pleasure!</p> <p>Well I didn&#39;t realize the the difference between the master branch and v2 branch. Does master means v1 currently? I should have just installed authboss using </p> <pre><code>go get </code></pre> <p>So is that v1? And I should uninstall it and install v2 again?</p> <p>As for the implementation of the database approach, I think I will repost it in github. Thanks for the guidance ;)</p></pre>aarondl: <pre><p>Yep. That&#39;s correct. Currently v2 is in rc stage which is why it&#39;s not in the master branch. Which means some things may break yet, but it&#39;ll be as small as we can manage, for example the Flash message interface is probably going to change soon to be a separate interface and separate cookie.</p> <p>However the effort in moving from v1 to v2 is non-trivial so even if you have to change a little bit of stuff you&#39;ll save a lot of headache in general. You can also pin to a specific tag to avoid dealing with the breaking changes (current latest rc is v2.0.0-rc4) until you&#39;re ready.</p> <p>So lastly because it&#39;s a branch and not in master, generally you can clone like this (keep in mind this assumes your GOPATH is a single directory and not multiple):</p> <pre><code>mkdir -p $GOPATH/src/ git clone --branch v2 $GOPATH/src/ </code></pre> <p>One more problem is that doesn&#39;t support branches, so you can run your own godoc server (it&#39;s pre-installed with Go):</p> <pre><code>godoc -http :8080 </code></pre> <p>Now you can see the v2 godoc documentation if you browse to http://localhost:8080/pkg/</p></pre>SpecialGoat: <pre><p>After a quick search I found <a href="" rel="nofollow">this</a>. Check out the comment there&#39;s a link to an example of a mysql storer. I haven&#39;t tested it but I&#39;m sure it would put you in the right direction.</p></pre>aarondl: <pre><p>Thanks for helping out SpecialGoat. The <a href="" rel="nofollow">sample</a> is a good place to start for sure. It&#39;s v2 branch includes the version that works with v2. Did want to also mention that we&#39;ve stopped using gitter just so people are aware.</p></pre>SouthAfricanPickle: <pre><p>Sorry if this is not the right context to ask but, since the opportunity is here...</p> <p>What options are there for password-less login with AuthBoss, if not, are any plans for it in the future?</p></pre>


入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:731990104

941 次点击  
加入收藏 微博
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传