mirror of
https://github.com/diamondburned/cchat-mock.git
synced 2025-01-29 21:27:22 +00:00
Added Authenticator struct, bumped to v0.0.9
This commit is contained in:
parent
45333c71c2
commit
807afeffb7
2
go.mod
2
go.mod
|
@ -4,5 +4,5 @@ go 1.14
|
|||
|
||||
require (
|
||||
github.com/Pallinder/go-randomdata v1.2.0
|
||||
github.com/diamondburned/cchat v0.0.8
|
||||
github.com/diamondburned/cchat v0.0.9
|
||||
)
|
||||
|
|
2
go.sum
2
go.sum
|
@ -16,4 +16,6 @@ github.com/diamondburned/cchat v0.0.7 h1:y5zbEoD6L8YHuN/yclqjokF0lPkRj5tYWOuJe0b
|
|||
github.com/diamondburned/cchat v0.0.7/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU=
|
||||
github.com/diamondburned/cchat v0.0.8 h1:/PmI23SFHJcjYBWNBwQbp36n7fDvDu+NMnQuhM5FM2E=
|
||||
github.com/diamondburned/cchat v0.0.8/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU=
|
||||
github.com/diamondburned/cchat v0.0.9 h1:+F96eDDuaOg4v4dz3GBDWbEW4dZ/k5uGrDp33/yeXR8=
|
||||
github.com/diamondburned/cchat v0.0.9/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
|
|
12
service.go
12
service.go
|
@ -24,13 +24,21 @@ func (s Service) Name() string {
|
|||
return "Mock"
|
||||
}
|
||||
|
||||
func (s Service) AuthenticateForm() []cchat.AuthenticateEntry {
|
||||
func (s Service) Authenticate() cchat.Authenticator {
|
||||
return Authenticator{}
|
||||
}
|
||||
|
||||
type Authenticator struct{}
|
||||
|
||||
var _ cchat.Authenticator = (*Authenticator)(nil)
|
||||
|
||||
func (Authenticator) AuthenticateForm() []cchat.AuthenticateEntry {
|
||||
return []cchat.AuthenticateEntry{{
|
||||
Name: "Username",
|
||||
}}
|
||||
}
|
||||
|
||||
func (s Service) Authenticate(form []string) (cchat.Session, error) {
|
||||
func (Authenticator) Authenticate(form []string) (cchat.Session, error) {
|
||||
ses := &Session{username: form[0]}
|
||||
ses.servers = GenerateServers(ses)
|
||||
return ses, nil
|
||||
|
|
Loading…
Reference in a new issue