~bigbes/core-go

f9c34fc34802dc71cd2a80769270305573aa2cc9 — Josh Junon 4 years ago 378fedb
auth: fix nil reference in auth method check
1 files changed, 6 insertions(+), 2 deletions(-)

M auth/middleware.go
M auth/middleware.go => auth/middleware.go +6 -2
@@ 302,10 302,14 @@ func internalAuth(internalNet []*net.IPNet, payload []byte,
	var auth *AuthContext
	if internalAuth.OAuthClientUUID != "" {
		auth, err = authForOAuthClient(r.Context(), internalAuth.OAuthClientUUID)
		auth.AuthMethod = AUTH_INTERNAL
		if err == nil {
			auth.AuthMethod = AUTH_INTERNAL
		}
	} else if internalAuth.Name != "" {
		auth, err = authForUsername(r.Context(), internalAuth.Name)
		auth.AuthMethod = AUTH_INTERNAL
		if err == nil {
			auth.AuthMethod = AUTH_INTERNAL
		}
	} else {
		// Using anonymous internal auth. This is only used in one specific
		// situation: registering for a new account.