MCPcopy Create free account

hub / github.com/reugn/auth-server / functions

Functions86 in github.com/reugn/auth-server

↓ 13 callersMethodString
String returns the string representation of the TokenType.
internal/auth/jwt.go:27
↓ 10 callersFunctionReadString
ReadString retrieves the string value of the environment variable named by the key.
internal/util/env/env.go:11
↓ 8 callersFunctionLogAttrs
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 callersMethodMarshal
Marshal marshals the AccessToken to a JSON string.
internal/auth/jwt.go:46
↓ 4 callersMethodvalidate
validate validates the logger configuration properties.
internal/config/logger.go:87
↓ 2 callersMethodAuthorize
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 callersMethodGenerate
Generate generates an AccessToken using the username and role claims.
internal/auth/jwt_generator.go:36
↓ 2 callersFunctionGetClientIP
GetClientIP extracts the client IP address from the request.
internal/util/httputil/http_request.go:11
↓ 2 callersFunctionNewJWTGenerator
NewJWTGenerator returns a new instance of JWTGenerator.
internal/auth/jwt_generator.go:25
↓ 2 callersFunctionNewJWTValidator
NewJWTValidator returns a new JWTValidator.
internal/auth/jwt_validator.go:21
↓ 2 callersFunctionNewKeys
NewKeys returns a new instance of Keys.
internal/auth/keys.go:20
↓ 2 callersFunctionNewLocal
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 callersFunctiongetAerospikeConfig
getAerospikeConfig gets the Aerospike configuration from the environment variables.
internal/repository/aerospike.go:42
↓ 2 callersFunctiongetFirstHeader
getFirstHeader returns the first non-empty header value from the provided headers.
internal/proxy/parser.go:145
↓ 2 callersFunctiongetVaultConfig
()
internal/repository/vault.go:36
↓ 2 callersFunctionisAuthorizedRequest
isAuthorizedRequest checks if the role has permissions to access the endpoint.
internal/repository/repository.go:43
↓ 2 callersFunctionparsePrivateKey
parsePrivateKey parses the private key from the file or the PEM bytes.
internal/auth/keys.go:56
↓ 2 callersFunctionparsePublicKey
parsePublicKey parses the public key from the file or the PEM bytes.
internal/auth/keys.go:70
↓ 2 callersFunctionpwdMatch
pwdMatch checks if the hashed password matches the plain password.
internal/repository/repository.go:69
↓ 1 callersMethodAddLimiter
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 callersMethodAuthenticateBasic
AuthenticateBasic validates the basic username and password before issuing a JWT.
internal/repository/repository.go:36
↓ 1 callersMethodAuthenticateBasic
AuthenticateBasic validates the basic username and password before issuing a JWT.
internal/repository/local.go:53
↓ 1 callersMethodAuthorizeRequest
AuthorizeRequest checks if the role has permissions to access the endpoint.
internal/repository/repository.go:39
↓ 1 callersMethodGetLimiter
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 callersFunctionNewAerospike
NewAerospike returns a new AerospikeRepository using environment variables for configuration.
internal/repository/aerospike.go:65
↓ 1 callersFunctionNewHTTPDefault
NewHTTPDefault returns a new HTTP config with default values.
internal/config/http_server.go:43
↓ 1 callersFunctionNewIPRateLimiter
NewIPRateLimiter returns a new IPRateLimiter.
internal/http/rate_limiter.go:89
↓ 1 callersFunctionNewIPWhiteList
NewIPWhiteList builds a new IPWhiteList from the list of IPs.
internal/http/rate_limiter.go:21
↓ 1 callersFunctionNewKeysFromFile
NewKeysFromFile creates and returns a new instance of Keys from the files containing the secrets information.
internal/auth/keys.go:26
↓ 1 callersFunctionNewLoggerDefault
NewLoggerDefault returns a new Logger with default values.
internal/config/logger.go:32
↓ 1 callersFunctionNewParser
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 callersFunctionNewSecretDefault
NewSecretDefault returns a new Secret with default values.
internal/config/secret.go:16
↓ 1 callersFunctionNewServer
NewServer returns a new instance of Server. It initializes the server with the given version, keys, and configuration.
internal/http/server.go:31
↓ 1 callersFunctionNewVault
NewVault returns a new VaultRepository using environment variables for configuration.
internal/repository/vault.go:54
↓ 1 callersMethodParseAuthorizationToken
ParseAuthorizationToken parses and returns an Authorization token from the original request.
internal/proxy/parser.go:18
↓ 1 callersMethodParseRequestDetails
ParseRequestDetails parses and returns a RequestDetails from the original request.
internal/proxy/parser.go:20
↓ 1 callersFunctionReadInt
ReadInt retrieves the integer value of the environment variable named by the key.
internal/util/env/env.go:20
↓ 1 callersFunctionReadTime
ReadTime retrieves the time value of the environment variable named by the key.
internal/util/env/env.go:32
↓ 1 callersMethodRepository
Repository returns the repository.Repository for the repository provider.
internal/config/service.go:77
↓ 1 callersMethodRequestParser
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 callersFunctionSha256
Sha256 returns the Sha256 hexadecimal representation of the string.
internal/util/hash/hash.go:9
↓ 1 callersMethodSigningMethodRSA
SigningMethodRSA returns the jwt.SigningMethodRSA for the signing method.
internal/config/service.go:54
↓ 1 callersMethodSlogHandler
SlogHandler returns a slog.Handler for the logger configuration.
internal/config/logger.go:57
↓ 1 callersMethodStart
Start initiates the HTTP server.
internal/http/server.go:88
↓ 1 callersMethodValidate
Validate validates the service configuration properties.
internal/config/service.go:91
↓ 1 callersFunctiongetClaims
getClaims gets the claims from the token.
internal/auth/jwt_validator.go:62
↓ 1 callersMethodisAllowed
isAllowed checks if the IP is in the white list.
internal/http/rate_limiter.go:54
↓ 1 callersMethodlogLevel
logLevel returns the slog.Level for the logger configuration.
internal/config/logger.go:101
↓ 1 callersMethodparseMethod
parseMethod extracts the HTTP method from forwarded headers or the request itself.
internal/proxy/parser.go:116
↓ 1 callersMethodparseURI
parseURI extracts the URI from forwarded headers or the request itself.
internal/proxy/parser.go:126
↓ 1 callersMethodrateLimiterMiddleware
(next http.Handler)
internal/http/server.go:62
↓ 1 callersFunctionreadConfiguration
readConfiguration reads the configuration file and returns the configuration.
cmd/auth/main.go:61
↓ 1 callersFunctionreconstructURI
reconstructURI combines a prefix with the current path.
internal/proxy/parser.go:155
↓ 1 callersFunctionrun
()
cmd/auth/main.go:19
↓ 1 callersMethodvalidate
validate validates the AccessToken. It returns the claims if the token is valid, an error otherwise.
internal/auth/jwt_validator.go:30
↓ 1 callersMethodvalidateClaims
validateClaims validates the claims of the token.
internal/auth/jwt_validator.go:46
MethodAuthenticateBasic
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
MethodAuthenticateBasic
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
MethodAuthorizeRequest
AuthorizeRequest checks if the role has permissions to access the endpoint.
internal/repository/aerospike.go:120
MethodAuthorizeRequest
AuthorizeRequest checks if the role has permissions to access the endpoint.
internal/repository/local.go:66
MethodAuthorizeRequest
AuthorizeRequest checks if the role has permissions to access the endpoint.
internal/repository/vault.go:102
FunctionHashAndSalt
HashAndSalt hashes and salts the password using the bcrypt algorithm.
internal/repository/repository.go:56
FunctionNewKeysFromPem
NewKeysFromPem creates and returns a new instance of Keys from the pem byte arrays.
internal/auth/keys.go:41
FunctionNewParserWithConfig
NewParserWithConfig returns a new Parser with a custom header configuration.
internal/proxy/parser.go:86
FunctionNewServiceDefault
NewServiceDefault returns a new Service config with default values.
internal/config/service.go:42
MethodParseAuthorizationToken
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
MethodParseRequestDetails
ParseRequestDetails parses and returns RequestDetails from the request.
internal/proxy/parser.go:108
MethodString
String returns a string representation of the RequestDetails.
internal/repository/repository.go:27
MethodString
String returns a string representation of the service configuration in JSON format.
internal/config/service.go:117
MethodStringYaml
StringYaml returns a string representation of the service configuration in YAML format.
internal/config/service.go:127
FunctionTestGetClientIP
(t *testing.T)
internal/util/httputil/http_request_test.go:12
FunctionTestJWT_Authorize
(t *testing.T)
internal/auth/jwt_test.go:12
FunctionTestLogAttrs
(t *testing.T)
internal/util/httputil/http_request_test.go:91
FunctionTestSha256
(t *testing.T)
internal/util/hash/hash_test.go:7
FunctionTest_getAerospikeConfig
(t *testing.T)
internal/repository/aerospike_test.go:8
FunctionTest_getVaultConfig
(t *testing.T)
internal/repository/vault_test.go:8
MethodauthActionHandler
(w http.ResponseWriter, r *http.Request)
internal/http/server.go:179
FunctionhealthActionHandler
(w http.ResponseWriter, _ *http.Request)
internal/http/server.go:122
Functionmain
()
cmd/auth/main.go:82
FunctionreadyActionHandler
(w http.ResponseWriter, _ *http.Request)
internal/http/server.go:126
FunctionrootActionHandler
(w http.ResponseWriter, r *http.Request)
internal/http/server.go:115
MethodtokenActionHandler
(w http.ResponseWriter, r *http.Request)
internal/http/server.go:134
Methodvalidate
validate validates the RateLimiter configuration.
internal/config/http_server.go:29
Methodvalidate
validate validates the HTTP configuration.
internal/config/http_server.go:56
Methodvalidate
validate validates the Secret configuration properties.
internal/config/secret.go:24
MethodversionActionHandler
(w http.ResponseWriter, _ *http.Request)
internal/http/server.go:130