实施1
type XAuth{ // talking to source1
field1 Type1
field2 Type2
}
func (d *XAuth) f1(x str){
// do something
}
func (d *XAuth) f2(x, y int){
// do something
}
实施 2
type YAuth { // talking to source2
field1 Type3
field2 Type4
}
func (d *YAuth) g1(x []str){
// do something
}
func (d *YAuth) g2(x, y str){
// do something
}
实施 3
type ZAuth{ // talking to source3
field1 Type4
field2 Type5
}
func (d *ZAuth) h1(x float64){
// do something
}
func (d *ZAuth) h2(y int){
// do something
}
func (d *ZAuth) h3(z str){
// do something
}
用户提供凭据user/passwd以验证上述 3 个实现。如果上述 3 个实现中的任何一个成功验证,则迭代这些实现并接受凭据。
公共 API 应该如何Auth(user,passwd)从这三种不同的实现中解耦?公共 API 的用户提供user/passwd