mirror of https://github.com/matrix-org/go-neb.git
Kegan Dougal
9 years ago
7 changed files with 179 additions and 1 deletions
-
26src/github.com/matrix-org/go-neb/api.go
-
13src/github.com/matrix-org/go-neb/auth/auth.go
-
22src/github.com/matrix-org/go-neb/auth/github/github.go
-
32src/github.com/matrix-org/go-neb/database/db.go
-
46src/github.com/matrix-org/go-neb/database/schema.go
-
5src/github.com/matrix-org/go-neb/goneb.go
-
36src/github.com/matrix-org/go-neb/types/types.go
@ -0,0 +1,13 @@ |
|||||
|
package auth |
||||
|
|
||||
|
import ( |
||||
|
"github.com/matrix-org/go-neb/auth/github" |
||||
|
"github.com/matrix-org/go-neb/database" |
||||
|
"github.com/matrix-org/go-neb/types" |
||||
|
) |
||||
|
|
||||
|
// RegisterModules registers all known modules so they can be retrieved via
|
||||
|
// type.GetAuthModule
|
||||
|
func RegisterModules(db *database.ServiceDB) { |
||||
|
types.RegisterAuthModule(&github.AuthModule{Database: db}) |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
package github |
||||
|
|
||||
|
import ( |
||||
|
"github.com/matrix-org/go-neb/database" |
||||
|
"github.com/matrix-org/go-neb/types" |
||||
|
) |
||||
|
|
||||
|
// AuthModule for github
|
||||
|
type AuthModule struct { |
||||
|
Database *database.ServiceDB |
||||
|
} |
||||
|
|
||||
|
// Type of the auth module
|
||||
|
func (*AuthModule) Type() string { |
||||
|
return "github" |
||||
|
} |
||||
|
|
||||
|
// Process a third-party auth request
|
||||
|
func (am *AuthModule) Process(tpa types.ThirdPartyAuth) (err error) { |
||||
|
_, err = am.Database.StoreThirdPartyAuth(tpa) |
||||
|
return |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue