Implementation 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
}
Implementation 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
}
Implementation 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 provides credentials user
/passwd
to validate with above 3 implementations. Iterate these implementations and accept the credentials if any of the above 3 implementations validate successfully.
How should the public API Auth(user,passwd)
de-couple from these three different implementations? user of the public API provides user
/passwd