mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 10:53:09 -06:00
Ignore handleRegistrationFlow() for gocyclo and add some doc/comments on the code
This commit is contained in:
parent
bb0da7ba9c
commit
58d3664943
|
|
@ -490,6 +490,7 @@ func Register(
|
||||||
|
|
||||||
// handleRegistrationFlow will direct and complete registration flow stages
|
// handleRegistrationFlow will direct and complete registration flow stages
|
||||||
// that the client has requested.
|
// that the client has requested.
|
||||||
|
// nolint: gocyclo
|
||||||
func handleRegistrationFlow(
|
func handleRegistrationFlow(
|
||||||
req *http.Request,
|
req *http.Request,
|
||||||
r registerRequest,
|
r registerRequest,
|
||||||
|
|
@ -551,7 +552,11 @@ func handleRegistrationFlow(
|
||||||
}
|
}
|
||||||
|
|
||||||
case authtypes.LoginTypeApplicationService:
|
case authtypes.LoginTypeApplicationService:
|
||||||
|
// Extract the access token from the request.
|
||||||
accessToken, err := auth.ExtractAccessToken(req)
|
accessToken, err := auth.ExtractAccessToken(req)
|
||||||
|
// Let the AS registration handler handle the process from here. We
|
||||||
|
// don't need a condition on that call since the registration is clearly
|
||||||
|
// stated as being AS-related.
|
||||||
return handleApplicationServiceRegistration(
|
return handleApplicationServiceRegistration(
|
||||||
accessToken, err, req, r, cfg, accountDB, deviceDB,
|
accessToken, err, req, r, cfg, accountDB, deviceDB,
|
||||||
)
|
)
|
||||||
|
|
@ -575,6 +580,14 @@ func handleRegistrationFlow(
|
||||||
req, r, sessionID, cfg, accountDB, deviceDB)
|
req, r, sessionID, cfg, accountDB, deviceDB)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handleApplicationServiceRegistration handles the registration of an
|
||||||
|
// application service's user by validating the AS from its access token and
|
||||||
|
// registering the user. Its two first parameters must be the two return values
|
||||||
|
// of the auth.ExtractAccessToken function.
|
||||||
|
// Returns an error if the access token couldn't be extracted from the request
|
||||||
|
// at an earlier step of the registration workflow, or if the provided access
|
||||||
|
// token doesn't belong to a valid AS, or if there was an issue completing the
|
||||||
|
// registration process.
|
||||||
func handleApplicationServiceRegistration(
|
func handleApplicationServiceRegistration(
|
||||||
accessToken string,
|
accessToken string,
|
||||||
tokenErr error,
|
tokenErr error,
|
||||||
|
|
@ -584,8 +597,8 @@ func handleApplicationServiceRegistration(
|
||||||
accountDB *accounts.Database,
|
accountDB *accounts.Database,
|
||||||
deviceDB *devices.Database,
|
deviceDB *devices.Database,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
// If the auth type explicitly relates to Application Services but
|
// Check if we previously had issues extracting the access token from the
|
||||||
// there's no access token provided, return an error.
|
// request.
|
||||||
if tokenErr != nil {
|
if tokenErr != nil {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusUnauthorized,
|
Code: http.StatusUnauthorized,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue