Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/reugn/auth-server
/ functions
Functions
86 in github.com/reugn/auth-server
⨍
Functions
86
◇
Types & classes
28
↓ 13 callers
Method
String
String returns the string representation of the TokenType.
internal/auth/jwt.go:27
↓ 10 callers
Function
ReadString
ReadString retrieves the string value of the environment variable named by the key.
internal/util/env/env.go:11
↓ 8 callers
Function
LogAttrs
LogAttrs returns log attributes for request logging. It includes IP address and user agent. Additional attributes can be provided.
internal/util/httputil/http_request.go:35
↓ 4 callers
Method
Marshal
Marshal marshals the AccessToken to a JSON string.
internal/auth/jwt.go:46
↓ 4 callers
Method
validate
validate validates the logger configuration properties.
internal/config/logger.go:87
↓ 2 callers
Method
Authorize
Authorize validates the token and authorizes the actual request. It returns true if the request is authorized, false otherwise.
internal/auth/jwt_validator.go:80
↓ 2 callers
Method
Generate
Generate generates an AccessToken using the username and role claims.
internal/auth/jwt_generator.go:36
↓ 2 callers
Function
GetClientIP
GetClientIP extracts the client IP address from the request.
internal/util/httputil/http_request.go:11
↓ 2 callers
Function
NewJWTGenerator
NewJWTGenerator returns a new instance of JWTGenerator.
internal/auth/jwt_generator.go:25
↓ 2 callers
Function
NewJWTValidator
NewJWTValidator returns a new JWTValidator.
internal/auth/jwt_validator.go:21
↓ 2 callers
Function
NewKeys
NewKeys returns a new instance of Keys.
internal/auth/keys.go:20
↓ 2 callers
Function
NewLocal
NewLocal returns a new Local repository using an environment variable to read a custom path to the configuration file.
internal/repository/local.go:35
↓ 2 callers
Function
getAerospikeConfig
getAerospikeConfig gets the Aerospike configuration from the environment variables.
internal/repository/aerospike.go:42
↓ 2 callers
Function
getFirstHeader
getFirstHeader returns the first non-empty header value from the provided headers.
internal/proxy/parser.go:145
↓ 2 callers
Function
getVaultConfig
()
internal/repository/vault.go:36
↓ 2 callers
Function
isAuthorizedRequest
isAuthorizedRequest checks if the role has permissions to access the endpoint.
internal/repository/repository.go:43
↓ 2 callers
Function
parsePrivateKey
parsePrivateKey parses the private key from the file or the PEM bytes.
internal/auth/keys.go:56
↓ 2 callers
Function
parsePublicKey
parsePublicKey parses the public key from the file or the PEM bytes.
internal/auth/keys.go:70
↓ 2 callers
Function
pwdMatch
pwdMatch checks if the hashed password matches the plain password.
internal/repository/repository.go:69
↓ 1 callers
Method
AddLimiter
AddLimiter creates a new rate limiter and adds it to the limiters map, using the IP address as the key.
internal/http/rate_limiter.go:101
↓ 1 callers
Method
AuthenticateBasic
AuthenticateBasic validates the basic username and password before issuing a JWT.
internal/repository/repository.go:36
↓ 1 callers
Method
AuthenticateBasic
AuthenticateBasic validates the basic username and password before issuing a JWT.
internal/repository/local.go:53
↓ 1 callers
Method
AuthorizeRequest
AuthorizeRequest checks if the role has permissions to access the endpoint.
internal/repository/repository.go:39
↓ 1 callers
Method
GetLimiter
GetLimiter returns the rate limiter for the provided IP address if it exists. Otherwise calls AddLimiter to add a new limiter to the map.
internal/http/rate_limiter.go:113
↓ 1 callers
Function
NewAerospike
NewAerospike returns a new AerospikeRepository using environment variables for configuration.
internal/repository/aerospike.go:65
↓ 1 callers
Function
NewHTTPDefault
NewHTTPDefault returns a new HTTP config with default values.
internal/config/http_server.go:43
↓ 1 callers
Function
NewIPRateLimiter
NewIPRateLimiter returns a new IPRateLimiter.
internal/http/rate_limiter.go:89
↓ 1 callers
Function
NewIPWhiteList
NewIPWhiteList builds a new IPWhiteList from the list of IPs.
internal/http/rate_limiter.go:21
↓ 1 callers
Function
NewKeysFromFile
NewKeysFromFile creates and returns a new instance of Keys from the files containing the secrets information.
internal/auth/keys.go:26
↓ 1 callers
Function
NewLoggerDefault
NewLoggerDefault returns a new Logger with default values.
internal/config/logger.go:32
↓ 1 callers
Function
NewParser
NewParser returns a Parser configured for a known proxy. Falls back to direct (no forwarded headers) if the proxy is unknown.
internal/proxy/parser.go:76
↓ 1 callers
Function
NewSecretDefault
NewSecretDefault returns a new Secret with default values.
internal/config/secret.go:16
↓ 1 callers
Function
NewServer
NewServer returns a new instance of Server. It initializes the server with the given version, keys, and configuration.
internal/http/server.go:31
↓ 1 callers
Function
NewVault
NewVault returns a new VaultRepository using environment variables for configuration.
internal/repository/vault.go:54
↓ 1 callers
Method
ParseAuthorizationToken
ParseAuthorizationToken parses and returns an Authorization token from the original request.
internal/proxy/parser.go:18
↓ 1 callers
Method
ParseRequestDetails
ParseRequestDetails parses and returns a RequestDetails from the original request.
internal/proxy/parser.go:20
↓ 1 callers
Function
ReadInt
ReadInt retrieves the integer value of the environment variable named by the key.
internal/util/env/env.go:20
↓ 1 callers
Function
ReadTime
ReadTime retrieves the time value of the environment variable named by the key.
internal/util/env/env.go:32
↓ 1 callers
Method
Repository
Repository returns the repository.Repository for the repository provider.
internal/config/service.go:77
↓ 1 callers
Method
RequestParser
RequestParser returns the proxy.RequestParser for the proxy provider. Supported providers: direct, nginx, traefik, envoy, haproxy, kong. Unknown provi
internal/config/service.go:72
↓ 1 callers
Function
Sha256
Sha256 returns the Sha256 hexadecimal representation of the string.
internal/util/hash/hash.go:9
↓ 1 callers
Method
SigningMethodRSA
SigningMethodRSA returns the jwt.SigningMethodRSA for the signing method.
internal/config/service.go:54
↓ 1 callers
Method
SlogHandler
SlogHandler returns a slog.Handler for the logger configuration.
internal/config/logger.go:57
↓ 1 callers
Method
Start
Start initiates the HTTP server.
internal/http/server.go:88
↓ 1 callers
Method
Validate
Validate validates the service configuration properties.
internal/config/service.go:91
↓ 1 callers
Function
getClaims
getClaims gets the claims from the token.
internal/auth/jwt_validator.go:62
↓ 1 callers
Method
isAllowed
isAllowed checks if the IP is in the white list.
internal/http/rate_limiter.go:54
↓ 1 callers
Method
logLevel
logLevel returns the slog.Level for the logger configuration.
internal/config/logger.go:101
↓ 1 callers
Method
parseMethod
parseMethod extracts the HTTP method from forwarded headers or the request itself.
internal/proxy/parser.go:116
↓ 1 callers
Method
parseURI
parseURI extracts the URI from forwarded headers or the request itself.
internal/proxy/parser.go:126
↓ 1 callers
Method
rateLimiterMiddleware
(next http.Handler)
internal/http/server.go:62
↓ 1 callers
Function
readConfiguration
readConfiguration reads the configuration file and returns the configuration.
cmd/auth/main.go:61
↓ 1 callers
Function
reconstructURI
reconstructURI combines a prefix with the current path.
internal/proxy/parser.go:155
↓ 1 callers
Function
run
()
cmd/auth/main.go:19
↓ 1 callers
Method
validate
validate validates the AccessToken. It returns the claims if the token is valid, an error otherwise.
internal/auth/jwt_validator.go:30
↓ 1 callers
Method
validateClaims
validateClaims validates the claims of the token.
internal/auth/jwt_validator.go:46
Method
AuthenticateBasic
AuthenticateBasic validates the basic username and password before issuing a JWT. It uses the bcrypt password-hashing function to validate the passwor
internal/repository/aerospike.go:92
Method
AuthenticateBasic
AuthenticateBasic validates the basic username and password before issuing a JWT. It uses the bcrypt password-hashing function to validate the passwor
internal/repository/vault.go:75
Method
AuthorizeRequest
AuthorizeRequest checks if the role has permissions to access the endpoint.
internal/repository/aerospike.go:120
Method
AuthorizeRequest
AuthorizeRequest checks if the role has permissions to access the endpoint.
internal/repository/local.go:66
Method
AuthorizeRequest
AuthorizeRequest checks if the role has permissions to access the endpoint.
internal/repository/vault.go:102
Function
HashAndSalt
HashAndSalt hashes and salts the password using the bcrypt algorithm.
internal/repository/repository.go:56
Function
NewKeysFromPem
NewKeysFromPem creates and returns a new instance of Keys from the pem byte arrays.
internal/auth/keys.go:41
Function
NewParserWithConfig
NewParserWithConfig returns a new Parser with a custom header configuration.
internal/proxy/parser.go:86
Function
NewServiceDefault
NewServiceDefault returns a new Service config with default values.
internal/config/service.go:42
Method
ParseAuthorizationToken
ParseAuthorizationToken parses and returns an Authorization Bearer token from the request. It returns an empty string if the authorization header is n
internal/proxy/parser.go:93
Method
ParseRequestDetails
ParseRequestDetails parses and returns RequestDetails from the request.
internal/proxy/parser.go:108
Method
String
String returns a string representation of the RequestDetails.
internal/repository/repository.go:27
Method
String
String returns a string representation of the service configuration in JSON format.
internal/config/service.go:117
Method
StringYaml
StringYaml returns a string representation of the service configuration in YAML format.
internal/config/service.go:127
Function
TestGetClientIP
(t *testing.T)
internal/util/httputil/http_request_test.go:12
Function
TestJWT_Authorize
(t *testing.T)
internal/auth/jwt_test.go:12
Function
TestLogAttrs
(t *testing.T)
internal/util/httputil/http_request_test.go:91
Function
TestSha256
(t *testing.T)
internal/util/hash/hash_test.go:7
Function
Test_getAerospikeConfig
(t *testing.T)
internal/repository/aerospike_test.go:8
Function
Test_getVaultConfig
(t *testing.T)
internal/repository/vault_test.go:8
Method
authActionHandler
(w http.ResponseWriter, r *http.Request)
internal/http/server.go:179
Function
healthActionHandler
(w http.ResponseWriter, _ *http.Request)
internal/http/server.go:122
Function
main
()
cmd/auth/main.go:82
Function
readyActionHandler
(w http.ResponseWriter, _ *http.Request)
internal/http/server.go:126
Function
rootActionHandler
(w http.ResponseWriter, r *http.Request)
internal/http/server.go:115
Method
tokenActionHandler
(w http.ResponseWriter, r *http.Request)
internal/http/server.go:134
Method
validate
validate validates the RateLimiter configuration.
internal/config/http_server.go:29
Method
validate
validate validates the HTTP configuration.
internal/config/http_server.go:56
Method
validate
validate validates the Secret configuration properties.
internal/config/secret.go:24
Method
versionActionHandler
(w http.ResponseWriter, _ *http.Request)
internal/http/server.go:130