ginauth

package
v1.30.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ginauth는 gin 기반 관리 API key 인증 middleware를 제공합니다.

패키지 개요

이 패키지는 shared-go의 프레임워크 독립 인증 비교 함수를 gin middleware로 감쌉니다. 빈 API key는 기본적으로 503으로 fail-closed 처리하며, 인증을 끄려면 AuthConfig.Disabled를 명시해야 합니다.

주요 사용 패턴

router := gin.New()
cfg := ginauth.AuthConfig{APIKey: apiKey}
router.Use(ginauth.AuthMiddleware(cfg))
router.NoRoute(ginauth.NoRouteHandler(cfg))

Index

Constants

View Source
const (
	// APIKeyHeader는 gin 인증 middleware가 읽는 API key 헤더 이름이다.
	APIKeyHeader = httputil.HeaderAPIKey
)

Variables

This section is empty.

Functions

func APIKeyAuthMiddleware deprecated

func APIKeyAuthMiddleware(apiKey string) gin.HandlerFunc

APIKeyAuthMiddleware는 hololive-shared형 gin API key 인증 middleware를 만든다.

Deprecated: 인증 비활성화가 필요하면 AuthMiddleware와 AuthConfig.Disabled를 명시하십시오.

func AuthMiddleware added in v1.30.1

func AuthMiddleware(cfg AuthConfig) gin.HandlerFunc

AuthMiddleware는 명시적인 설정으로 Gin API key 인증 middleware를 만든다.

func NoRouteAuthHandler deprecated

func NoRouteAuthHandler(apiKey string) gin.HandlerFunc

NoRouteAuthHandler는 인증 후에도 not_found JSON을 반환하는 gin NoRoute handler를 만든다.

Deprecated: 인증 비활성화가 필요하면 NoRouteHandler와 AuthConfig.Disabled를 명시하십시오.

func NoRouteHandler added in v1.30.1

func NoRouteHandler(cfg AuthConfig) gin.HandlerFunc

NoRouteHandler는 명시적인 설정으로 인증 후 not_found JSON을 반환하는 Gin NoRoute handler를 만든다.

Types

type AuthConfig added in v1.30.1

type AuthConfig = httputil.AdminAuthConfig

AuthConfig는 Gin API key 인증 설정이다. zero value는 인증을 강제하고 빈 key를 fail-closed로 처리한다.

Jump to

Keyboard shortcuts

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