mirror of
https://github.com/volatiletech/authboss.git
synced 2025-02-03 13:21:22 +02:00
Remove gopkg.in
This commit is contained in:
parent
7ccb973d79
commit
0c3d6d26ca
48
README.md
48
README.md
@ -3,7 +3,7 @@
|
||||
Authboss
|
||||
========
|
||||
|
||||
[![GoDoc](https://godoc.org/gopkg.in/authboss.v1?status.svg)](https://godoc.org/gopkg.in/authboss.v1) [![Build Status](https://circleci.com/gh/go-authboss/authboss.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/go-authboss/authboss) [![Coverage Status](https://coveralls.io/repos/go-authboss/authboss/badge.svg?branch=master)](https://coveralls.io/r/go-authboss/authboss?branch=master) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-authboss/authboss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
[![GoDoc](https://godoc.org/github.com/go-authboss/authboss?status.svg)](https://godoc.org/github.com/go-authboss/authboss) [![Build Status](https://circleci.com/gh/go-authboss/authboss.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/go-authboss/authboss) [![Coverage Status](https://coveralls.io/repos/go-authboss/authboss/badge.svg?branch=master)](https://coveralls.io/r/go-authboss/authboss?branch=master) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-authboss/authboss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
Authboss is a modular authentication system for the web. It tries to remove as much boilerplate and "hard things" as possible so that
|
||||
each time you start a new web project in Go, you can plug it in, configure, and start building your app without having to build an
|
||||
@ -39,13 +39,13 @@ use them in your app.
|
||||
|
||||
Name | Import Path | Description
|
||||
---------------|-----------------------------------------------------------------------------------------------------|------------
|
||||
Auth | [gopkg.in/authboss.v1/auth](https://github.com/go-authboss/authboss/tree/master/auth) | Provides database password authentication for users.
|
||||
Confirm | [gopkg.in/authboss.v1/confirm](https://github.com/go-authboss/authboss/tree/master/confirm) | Sends an e-mail verification before allowing users to log in.
|
||||
Lock | [gopkg.in/authboss.v1/lock](https://github.com/go-authboss/authboss/tree/master/lock) | Locks user accounts after N authentication failures in M time.
|
||||
OAuth2 | [gopkg.in/authboss.v1/oauth2](https://github.com/go-authboss/authboss/tree/master/oauth2) | Provides oauth2 authentication for users.
|
||||
Recover | [gopkg.in/authboss.v1/recover](https://github.com/go-authboss/authboss/tree/master/recover) | Allows for password resets via e-mail.
|
||||
Register | [gopkg.in/authboss.v1/register](https://github.com/go-authboss/authboss/tree/master/register) | User-initiated account creation.
|
||||
Remember | [gopkg.in/authboss.v1/remember](https://github.com/go-authboss/authboss/tree/master/remember) | Persisting login sessions past session cookie expiry.
|
||||
Auth | [github.com/go-authboss/authboss/auth](https://github.com/go-authboss/authboss/tree/master/auth) | Provides database password authentication for users.
|
||||
Confirm | [github.com/go-authboss/authboss/confirm](https://github.com/go-authboss/authboss/tree/master/confirm) | Sends an e-mail verification before allowing users to log in.
|
||||
Lock | [github.com/go-authboss/authboss/lock](https://github.com/go-authboss/authboss/tree/master/lock) | Locks user accounts after N authentication failures in M time.
|
||||
OAuth2 | [github.com/go-authboss/authboss/oauth2](https://github.com/go-authboss/authboss/tree/master/oauth2) | Provides oauth2 authentication for users.
|
||||
Recover | [github.com/go-authboss/authboss/recover](https://github.com/go-authboss/authboss/tree/master/recover) | Allows for password resets via e-mail.
|
||||
Register | [github.com/go-authboss/authboss/register](https://github.com/go-authboss/authboss/tree/master/register) | User-initiated account creation.
|
||||
Remember | [github.com/go-authboss/authboss/remember](https://github.com/go-authboss/authboss/tree/master/remember) | Persisting login sessions past session cookie expiry.
|
||||
|
||||
Getting Started
|
||||
===============
|
||||
@ -53,10 +53,10 @@ Getting Started
|
||||
Install the library and import it:
|
||||
|
||||
```
|
||||
go get gopkg.in/authboss.v1
|
||||
go get github.com/go-authboss/authboss
|
||||
```
|
||||
|
||||
After that a good place to start in any Authboss implementation is the [configuration struct](http://godoc.org/gopkg.in/authboss.v1#Config).
|
||||
After that a good place to start in any Authboss implementation is the [configuration struct](http://godoc.org/github.com/go-authboss/authboss#Config).
|
||||
There are many defaults setup for you but there are some elements that must be provided.
|
||||
to find out what is configurable view the documentation linked to above, each struct element
|
||||
is documented.
|
||||
@ -141,7 +141,7 @@ user struct, nil | The user is logged in.
|
||||
Because on password reset various cleanings need to happen (for example Remember Me tokens
|
||||
should all be deleted) setting the user's password yourself is not a good idea.
|
||||
|
||||
Authboss has the [UpdatePassword](http://godoc.org/gopkg.in/authboss.v1#Authboss.UpdatePassword) method for you to use. Please consult it's documentation
|
||||
Authboss has the [UpdatePassword](http://godoc.org/github.com/go-authboss/authboss#Authboss.UpdatePassword) method for you to use. Please consult it's documentation
|
||||
for a thorough explanation of each parameter and usage.
|
||||
|
||||
```go
|
||||
@ -166,7 +166,7 @@ if err != nil {
|
||||
|
||||
## <a name="auth"></a>User Authentication via Password
|
||||
**Requirements:**
|
||||
- Auth module ([gopkg.in/authboss.v1/auth](https://github.com/go-authboss/authboss/tree/master/auth))
|
||||
- Auth module ([github.com/go-authboss/authboss/auth](https://github.com/go-authboss/authboss/tree/master/auth))
|
||||
- [Storer](#storers)
|
||||
- [Session Storer](#client_storers)
|
||||
- [Views](#views)
|
||||
@ -183,7 +183,7 @@ Another link is created for a logout. Simply link/redirect the user to this page
|
||||
|
||||
## <a name="oauth2"></a> User Authentication via OAuth2
|
||||
**Requirements:**
|
||||
- OAuth2 module ([gopkg.in/authboss.v1/oauth2](https://github.com/go-authboss/authboss/tree/master/oauth2))
|
||||
- OAuth2 module ([github.com/go-authboss/authboss/oauth2](https://github.com/go-authboss/authboss/tree/master/oauth2))
|
||||
- [OAuth2Storer](#storers)
|
||||
- OAuth2Providers
|
||||
- [Session and Cookie Storers](#client_storers)
|
||||
@ -198,7 +198,7 @@ Another link is created for a logout. Simply link/redirect the user to this page
|
||||
**How it works:** Routes are registered for each oauth2 provider you specify in the OAuth2Providers configuration.
|
||||
You redirect the user to one of these initial routes (/mount_path/oauth2/providername) and the oauth2 module
|
||||
will ensure the user logs in and receives a token. It then calls the Callback you specify in your OAuth2Provider
|
||||
inside the config, this is responsible for returning various information, please see the docs for [OAuth2Provider](http://godoc.org/gopkg.in/authboss.v1#OAuth2Provider).
|
||||
inside the config, this is responsible for returning various information, please see the docs for [OAuth2Provider](http://godoc.org/github.com/go-authboss/authboss#OAuth2Provider).
|
||||
Once the callback is complete, the user is saved in the database, and logged in using the session.
|
||||
|
||||
Please note that in order to redirect to specific URLs or have the user use the remember module for oauth2 logins you must pass
|
||||
@ -220,7 +220,7 @@ uri := `/authboss_mount_path/oauth2/google?` + params.Encode()
|
||||
|
||||
## <a name="register"></a> User Registration
|
||||
**Requirements:**
|
||||
- Register module ([gopkg.in/authboss.v1/register](https://github.com/go-authboss/authboss/tree/master/register))
|
||||
- Register module ([github.com/go-authboss/authboss/register](https://github.com/go-authboss/authboss/tree/master/register))
|
||||
- [RegisterStorer](#storers)
|
||||
- [Session Storer](#client_storers)
|
||||
- [Views](#views)
|
||||
@ -239,8 +239,8 @@ See also: [Validation](#validation)
|
||||
|
||||
## <a name="confirm"></a> Confirming Registrations
|
||||
**Requirements:**
|
||||
- Register module ([gopkg.in/authboss.v1/register](https://github.com/go-authboss/authboss/tree/master/register))
|
||||
- Confirm module ([gopkg.in/authboss.v1/confirm](https://github.com/go-authboss/authboss/tree/master/confirm))
|
||||
- Register module ([github.com/go-authboss/authboss/register](https://github.com/go-authboss/authboss/tree/master/register))
|
||||
- Confirm module ([github.com/go-authboss/authboss/confirm](https://github.com/go-authboss/authboss/tree/master/confirm))
|
||||
- [RegisterStorer](#storers)
|
||||
- [Session and Cookie Storers](#client_storers)
|
||||
- [Views](#views)
|
||||
@ -255,7 +255,7 @@ provided in the e-mail and their account becomes confirmed, they will automatica
|
||||
|
||||
## <a name="recover"></a> Password Recovery
|
||||
**Requirements:**
|
||||
- Recover module ([gopkg.in/authboss.v1/recover](https://github.com/go-authboss/authboss/tree/master/recover))
|
||||
- Recover module ([github.com/go-authboss/authboss/recover](https://github.com/go-authboss/authboss/tree/master/recover))
|
||||
- [RecoverStorer](#storers)
|
||||
- [Session Storer](#client_storers)
|
||||
- [Views](#views)
|
||||
@ -271,7 +271,7 @@ their new password is stored, they are logged in and redirected to the RecoverOK
|
||||
|
||||
## <a name="remember"></a> Remember Me (persistent login)
|
||||
**Requirements:**
|
||||
- Remember module ([gopkg.in/authboss.v1/remember](https://github.com/go-authboss/authboss/tree/master/remember))
|
||||
- Remember module ([github.com/go-authboss/authboss/remember](https://github.com/go-authboss/authboss/tree/master/remember))
|
||||
- [RememberStorer](#storers)
|
||||
- [Session and Cookie Storers](#client_storers)
|
||||
|
||||
@ -299,7 +299,7 @@ to pages with sensitive information if this value is true in the session, and fo
|
||||
|
||||
## <a name="lock"></a> Locking Accounts for Authentication Failures
|
||||
**Requirements:**
|
||||
- Lock module ([gopkg.in/authboss.v1/lock](https://github.com/go-authboss/authboss/tree/master/lock))
|
||||
- Lock module ([github.com/go-authboss/authboss/lock](https://github.com/go-authboss/authboss/tree/master/lock))
|
||||
- [Storer](#storers)
|
||||
|
||||
**Storage Requirements:**
|
||||
@ -314,7 +314,7 @@ locked for the configured LockDuration. After this duration the user will be abl
|
||||
|
||||
## <a name="expire"></a> Expiring Inactive User Sessions
|
||||
**Requirements:**
|
||||
- [ExpireMiddleware](http://godoc.org/gopkg.in/authboss.v1#Authboss.ExpireMiddleware)
|
||||
- [ExpireMiddleware](http://godoc.org/github.com/go-authboss/authboss#Authboss.ExpireMiddleware)
|
||||
- [Session Storer](#client_storers)
|
||||
|
||||
**How it works:** A middleware is installed into the stack. This middleware uses the session to log the last action time of the user.
|
||||
@ -329,7 +329,7 @@ http.ListenAndServe(":8080", ab.ExpireMiddleware(mux)) // Install the middleware
|
||||
|
||||
**Field validation:** Validation is achieved through the use of policies. These policies are in the configuration. They can be added for any field.
|
||||
Any type can be used for validation that implements the Validator interface. Authboss supplies a quite flexible field validator called
|
||||
[Rules](http://godoc.org/gopkg.in/authboss.v1#Rules) that you can use instead of writing your own. Validation errors are reported and
|
||||
[Rules](http://godoc.org/github.com/go-authboss/authboss#Rules) that you can use instead of writing your own. Validation errors are reported and
|
||||
handled all in the same way, and the view decides how to display these to the user. See the examples or the authboss default view files to see
|
||||
how to display errors.
|
||||
|
||||
@ -377,8 +377,8 @@ There are three parts to storage: Storer interfaces, User Struct, Binding/Unbind
|
||||
|
||||
#### Storer Interfaces
|
||||
|
||||
- [Storer](http://godoc.org/gopkg.in/authboss.v1#Storer)
|
||||
- [OAuth2Storer](http://godoc.org/gopkg.in/authboss.v1#OAuth2Storer)
|
||||
- [Storer](http://godoc.org/github.com/go-authboss/authboss#Storer)
|
||||
- [OAuth2Storer](http://godoc.org/github.com/go-authboss/authboss#OAuth2Storer)
|
||||
- [ConfirmStorer](http://godoc.org/gopkg.in/confirm/authboss.v1#ConfirmStorer)
|
||||
- [RecoverStorer](http://godoc.org/gopkg.in/recover/authboss.v1#RecoverStorer)
|
||||
- [RegisterStorer](http://godoc.org/gopkg.in/register/authboss.v1#RegisterStorer)
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/response"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/response"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/mocks"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/mocks"
|
||||
)
|
||||
|
||||
func testSetup() (a *Auth, s *mocks.MockStorer) {
|
||||
|
@ -4,7 +4,7 @@ remove as much boilerplate and "hard things" as possible so that each time you
|
||||
start a new web project in Go, you can plug it in, configure and be off to the
|
||||
races without having to think about how to store passwords or remember tokens.
|
||||
*/
|
||||
package authboss // import "gopkg.in/authboss.v0"
|
||||
package authboss
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
12
circle.yml
12
circle.yml
@ -4,21 +4,21 @@ machine:
|
||||
checkout:
|
||||
post:
|
||||
- mkdir -p /home/ubuntu/.go_project/src/gopkg.in
|
||||
- ln -s /home/ubuntu/authboss /home/ubuntu/.go_project/src/gopkg.in/authboss.v0
|
||||
- ln -s /home/ubuntu/authboss /home/ubuntu/.go_project/src/github.com/go-authboss/authboss
|
||||
dependencies:
|
||||
override:
|
||||
- cd /home/ubuntu/.go_project/src/gopkg.in/authboss.v0 && go get -t -d -v ./...
|
||||
- cd /home/ubuntu/.go_project/src/gopkg.in/authboss.v0 && go build -v
|
||||
- cd /home/ubuntu/.go_project/src/github.com/go-authboss/authboss && go get -t -d -v ./...
|
||||
- cd /home/ubuntu/.go_project/src/github.com/go-authboss/authboss && go build -v
|
||||
test:
|
||||
pre:
|
||||
- go get github.com/jstemmer/go-junit-report
|
||||
- go get github.com/mattn/goveralls
|
||||
override:
|
||||
- >
|
||||
cd /home/ubuntu/.go_project/src/gopkg.in/authboss.v0 &&
|
||||
cd /home/ubuntu/.go_project/src/github.com/go-authboss/authboss &&
|
||||
go test -v -race ./... > $CIRCLE_ARTIFACTS/gotest.txt
|
||||
- >
|
||||
cd /home/ubuntu/.go_project/src/gopkg.in/authboss.v0 &&
|
||||
cd /home/ubuntu/.go_project/src/github.com/go-authboss/authboss &&
|
||||
echo "mode: set" > $CIRCLE_ARTIFACTS/coverage.txt &&
|
||||
for i in $(go list ./...); do
|
||||
rm -f coverage.tmp;
|
||||
@ -29,6 +29,6 @@ test:
|
||||
- cat $CIRCLE_ARTIFACTS/gotest.txt | /home/ubuntu/.go_project/bin/go-junit-report > $CIRCLE_TEST_REPORTS/junit.xml
|
||||
- >
|
||||
if [ -n "$COVERALLS_TOKEN" ]; then
|
||||
cd /home/ubuntu/.go_project/src/gopkg.in/authboss.v0 &&
|
||||
cd /home/ubuntu/.go_project/src/github.com/go-authboss/authboss &&
|
||||
/home/ubuntu/.go_project/bin/goveralls -coverprofile=$CIRCLE_ARTIFACTS/coverage.txt -service=circle-ci -repotoken=$COVERALLS_TOKEN;
|
||||
fi
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
"net/url"
|
||||
"path"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/response"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/response"
|
||||
)
|
||||
|
||||
// Storer and FormValue constants
|
||||
|
@ -12,8 +12,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/mocks"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/mocks"
|
||||
)
|
||||
|
||||
func setup() *Confirm {
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"github.com/go-authboss/authboss"
|
||||
)
|
||||
|
||||
// MockUser represents all possible fields a authboss User may have
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"github.com/go-authboss/authboss"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/mocks"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/mocks"
|
||||
)
|
||||
|
||||
var testViewTemplate = template.Must(template.New("").Parse(`{{.external}} {{.fun}} {{.flash_success}} {{.flash_error}} {{.xsrfName}} {{.xsrfToken}}`))
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"github.com/go-authboss/authboss"
|
||||
)
|
||||
|
||||
// Storage key constants
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/mocks"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/mocks"
|
||||
)
|
||||
|
||||
func TestStorage(t *testing.T) {
|
||||
|
@ -13,8 +13,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/response"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/response"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -14,8 +14,8 @@ import (
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/oauth2/facebook"
|
||||
"golang.org/x/oauth2/google"
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/mocks"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/mocks"
|
||||
)
|
||||
|
||||
var testProviders = map[string]authboss.OAuth2Provider{
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2"
|
||||
"gopkg.in/authboss.v0"
|
||||
"github.com/go-authboss/authboss"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2"
|
||||
"gopkg.in/authboss.v0"
|
||||
"github.com/go-authboss/authboss"
|
||||
)
|
||||
|
||||
func TestGoogle(t *testing.T) {
|
||||
|
@ -13,8 +13,8 @@ import (
|
||||
"time"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/response"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/response"
|
||||
)
|
||||
|
||||
// Storage constants
|
||||
|
@ -12,8 +12,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/mocks"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/mocks"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/response"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/response"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/mocks"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/mocks"
|
||||
)
|
||||
|
||||
func setup() *Register {
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"github.com/go-authboss/authboss"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"gopkg.in/authboss.v0"
|
||||
"gopkg.in/authboss.v0/internal/mocks"
|
||||
"github.com/go-authboss/authboss"
|
||||
"github.com/go-authboss/authboss/internal/mocks"
|
||||
)
|
||||
|
||||
func TestInitialize(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user