authzsig

package
v1.6.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package authzsig provides HMAC-SHA256 signing and verification for OAuth2 authorize request parameters. This prevents tampering with hidden form fields (scope, code_challenge, code_challenge_method, nonce) between the authorize and login/signup steps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sign

func Sign(p AuthorizeParams) string

Sign computes an HMAC-SHA256 signature over the authorize parameters using the CSRF secret key. The signature is returned as a base64url-encoded string.

func Verify

func Verify(p AuthorizeParams, signature string) bool

Verify checks that the provided signature matches the HMAC of the given authorize parameters. Returns true if valid, false if tampered.

Types

type AuthorizeParams

type AuthorizeParams struct {
	ClientID            string
	RedirectURI         string
	Scope               string
	Nonce               string
	CodeChallenge       string
	CodeChallengeMethod string
	State               string
}

AuthorizeParams holds the security-sensitive parameters from the authorize request that must be protected against tampering.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL