github.com/jcarley/cli@v0.0.0-20180201210820-966d90434c30/lib/auth/contract.go (about) 1 package auth 2 3 import ( 4 "github.com/daticahealth/cli/lib/prompts" 5 "github.com/daticahealth/cli/models" 6 ) 7 8 // IAuth represents the contract that concrete implementations should follow 9 // when implementing authentication. 10 type IAuth interface { 11 Signin() (*models.User, error) 12 Signout() error 13 Verify() (*models.User, error) 14 } 15 16 // SAuth is a concrete implementation of IAuth 17 type SAuth struct { 18 Settings *models.Settings 19 Prompts prompts.IPrompts 20 } 21 22 func New(settings *models.Settings, prompts prompts.IPrompts) IAuth { 23 return &SAuth{ 24 Settings: settings, 25 Prompts: prompts, 26 } 27 }