Documentation ¶
Index ¶
- func ExecRequest(action string, req *http.Request, client *http.Client, ignoreCodes ...int) (*http.Response, error)
- func NewSignedRequest(method string, urlStr string, body io.Reader, signature Signature) (*http.Request, error)
- type ClientServiceAPI
- func (c *ClientServiceAPI) ConfirmClientAuth(userID, clientID string) (*oauth2.ClientAuth, error)
- func (c *ClientServiceAPI) DeleteClientAuth(clientID, code string) error
- func (c *ClientServiceAPI) GetClient(clientID string) (*oauth2.Client, error)
- func (c *ClientServiceAPI) GetClientAuth(clientID, code string) (*oauth2.ClientAuth, error)
- func (c *ClientServiceAPI) GetClientAuthForUser(userID, clientID string) (*oauth2.ClientAuth, error)
- func (c *ClientServiceAPI) SaveClientAuth(clientAuth *oauth2.ClientAuth) error
- func (c *ClientServiceAPI) UpdateUserData(clientID, code, userID, userData string) error
- func (c *ClientServiceAPI) VerifyClientCredentials(clientID, clientSecret string) (*oauth2.Client, error)
- type OAuth2TokenService
- type Signature
- type UserServiceAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientServiceAPI ¶
type ClientServiceAPI struct { // ServiceURL Clients (Apps) microservice URL. ServiceURL string // Client pointer to the HTTP client. *http.Client // Signature is the signature data for the self-issued JWT for access the dependency microservices. Signature // ClientAuthRepository is the ClientAuthRepository for accessing the locally persisted data. db.ClientAuthRepository }
ClientServiceAPI holds the values for oauth2.ClientService implementation. This combines the access to a remote Clients (Apps) service and locally persisted ClientAuth repository.
func NewClientService ¶
func NewClientService(serverConfig *config.ServerConfig, client *http.Client, keyStore tools.KeyStore) (*ClientServiceAPI, func(), error)
NewClientService creates new oauth2.ClientService.
func (*ClientServiceAPI) ConfirmClientAuth ¶
func (c *ClientServiceAPI) ConfirmClientAuth(userID, clientID string) (*oauth2.ClientAuth, error)
ConfirmClientAuth confirms that the user has authorized the client. It updates the ClientAuth in the client auth repository.
func (*ClientServiceAPI) DeleteClientAuth ¶
func (c *ClientServiceAPI) DeleteClientAuth(clientID, code string) error
DeleteClientAuth removes the clientAuth identified by client id and auth code.
func (*ClientServiceAPI) GetClient ¶
func (c *ClientServiceAPI) GetClient(clientID string) (*oauth2.Client, error)
GetClient retrieves a client data from the clients (apps) microservice.
func (*ClientServiceAPI) GetClientAuth ¶
func (c *ClientServiceAPI) GetClientAuth(clientID, code string) (*oauth2.ClientAuth, error)
GetClientAuth looks up a clientAuth for the specified client and auth code.
func (*ClientServiceAPI) GetClientAuthForUser ¶
func (c *ClientServiceAPI) GetClientAuthForUser(userID, clientID string) (*oauth2.ClientAuth, error)
GetClientAuthForUser looks up a clientAuth for the specified client and user.
func (*ClientServiceAPI) SaveClientAuth ¶
func (c *ClientServiceAPI) SaveClientAuth(clientAuth *oauth2.ClientAuth) error
SaveClientAuth stores the clientAuth in the client auth repository.
func (*ClientServiceAPI) UpdateUserData ¶
func (c *ClientServiceAPI) UpdateUserData(clientID, code, userID, userData string) error
UpdateUserData updates the user data of the clientAuth identified by the client ID and auth code.
func (*ClientServiceAPI) VerifyClientCredentials ¶
func (c *ClientServiceAPI) VerifyClientCredentials(clientID, clientSecret string) (*oauth2.Client, error)
VerifyClientCredentials verifies a client (app) for the supplied credentials on the clients (apps) microservice.
type OAuth2TokenService ¶
type OAuth2TokenService struct { // TokenRepository is the db.TokenRepository for persisting the oauth2 tokens. db.TokenRepository }
OAuth2TokenService hold the data for implementation of oauth2.TokenService.
func NewTokenService ¶
func NewTokenService(serverConfig *config.ServerConfig) (*OAuth2TokenService, func(), error)
NewTokenService creates new oauth2.TokenService from a given ServerConfig.
func (*OAuth2TokenService) GetToken ¶
func (t *OAuth2TokenService) GetToken(refreshToken string) (*oauth2.AuthToken, error)
GetToken retrieves a token from the underlying token repository. The token is checked if it is expired.
func (*OAuth2TokenService) GetTokenForClient ¶
func (t *OAuth2TokenService) GetTokenForClient(userID, clientID string) (*oauth2.AuthToken, error)
GetTokenForClient retrieves a token for the client and user from the token repository. The token is checked if it is expired.
type Signature ¶
type Signature struct { // SigningMethod is the method used for signing the JWT. Valid values are "RS256", "RS384" and "RS512". SigningMethod string // Key is the private key used for signing the JWT. Key interface{} // Claims is the map of standard and custom defined claims for the JWT. Claims map[string]interface{} }
Signature holds the data for signing the self-issued JWTs for accessing dependencies microservices.
func NewClientSignature ¶
func NewClientSignature(serverName string, securityConf config.Security, keyStore tools.KeyStore) (*Signature, error)
NewClientSignature builds new Signature containing the data and claims for signing the JWT tokens.
func NewSystemSignature ¶
func NewSystemSignature(serverName string, securityConf config.Security, keyStore tools.KeyStore) (*Signature, error)
NewSystemSignature generates a common Signature from a given configuration. This Signature is issued with system authentication and used for communication with other microservices on the platform.
type UserServiceAPI ¶
type UserServiceAPI struct { // ServiceURL is the URL of the user microservice. ServiceURL string // Client is the http.Client used for all requests. *http.Client // Signature is the Signature of this server used for signing the self-issued JWTs. Signature }
UserServiceAPI holds the data for implementation of oauth2.UserService.
func NewUserService ¶
func NewUserService(serverConfig *config.ServerConfig, client *http.Client, keyStore tools.KeyStore) (*UserServiceAPI, error)
NewUserService crates new UserServiceAPI from the ServerConfig.
func (*UserServiceAPI) VerifyUser ¶
func (u *UserServiceAPI) VerifyUser(email, password string) (*oauth2.User, error)
VerifyUser makes a call to the user microservice to verify the user credentials.