Added Authenticator struct, bumped to v0.0.9

This commit is contained in:
diamondburned (Forefront) 2020-05-25 15:29:06 -07:00
parent 45333c71c2
commit 807afeffb7
3 changed files with 13 additions and 3 deletions

2
go.mod
View File

@ -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
View File

@ -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=

View File

@ -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