Allow multiple implementations of Authenticator

This commit breaks the API to allow backends to return a slice of
Authenticators instead of a single Authenticator in the Service
interface. This is because some services might allow for more than one
method of authentication.

Note that the representation of multiple authenticators depends on the
frontend. One may choose to use tabs, notebooks, stacks, or anything
that is reasonable.
This commit is contained in:
diamondburned 2020-10-26 21:44:09 -07:00
parent b5dabacff4
commit 642f13a8c3
2 changed files with 7 additions and 6 deletions

View File

@ -283,7 +283,8 @@ type Commander interface {
// []string{"echo", "\"This", "is", "a", "string\""}
//
// A helper function for this kind of behavior is available in package split,
// under the ArgsIndexed function.
// under the ArgsIndexed function. This implementation also provides the rough
// specifications.
Run(words []string) ([]byte, error) // Blocking
// Asserters.
@ -691,8 +692,8 @@ type ServersContainer interface {
}
// A service is a complete service that's capable of multiple sessions. It has
// to implement the Authenticate() method, which returns an implementation of
// Authenticator.
// to implement the Authenticate() method, which returns multiple
// implementations of Authenticator.
//
// A service can implement SessionRestorer, which would indicate the frontend
// that it can restore past sessions. Sessions are saved using the SessionSaver
@ -707,7 +708,7 @@ type Service interface {
// Namer returns the name of the service.
Namer
Authenticate() Authenticator
Authenticate() []Authenticator
// Asserters.

View File

@ -638,7 +638,7 @@ var Main = Packages{
Comment: Comment{`
A service is a complete service that's capable of multiple
sessions. It has to implement the Authenticate() method, which
returns an implementation of Authenticator.
returns multiple implementations of Authenticator.
A service can implement SessionRestorer, which would indicate
the frontend that it can restore past sessions. Sessions are
@ -661,7 +661,7 @@ var Main = Packages{
Methods: []Method{
GetterMethod{
method: method{Name: "Authenticate"},
Returns: []NamedType{{Type: "Authenticator"}},
Returns: []NamedType{{Type: "[]Authenticator"}},
},
AsserterMethod{
ChildType: "Configurator",