package
2.34.1
Repository: https://github.com/skf/go-utility.git
Documentation: pkg.go.dev

# README

Migration

Migration from 1.* to 2.*

  • CorsMiddleware

    The old CorsMiddlewareV2 is now replaced by CorsMiddleware

    Migration steps:

    • If you are using CorsMiddlewareV2, change it to CorsMiddleware

    • If you are using CorsMiddleware, add this code to the endpoints that need CORS, remember to configure it to your needs.

      server.mux.
      	HandleFunc("<path>", http_middleware.Options(
      		[]string{http.MethodGet},
      		[]string{http_model.HeaderContentType},
      	)).
      	Methods(http.MethodOptions)
      
  • AuthenticateMiddleware

    The old AuthenticateMiddleware has been modified to take care of retrieving User ID by itself.

    Migration steps:

    • Add the following code to your main file.
      http_middleware.Configure(
          http_middleware.Config{Stage: authenticateStage},
      )
      

# Packages

No description provided by the author
No description provided by the author

# Functions

AuthenticateMiddleware retrieves the security configuration for the matched route and handles Access Token validation and stores the token claims in the request context.
AuthenticateMiddlewareV3 retrieves the security configuration for the matched route and handles Access Token validation and stores the token claims in the request context.
AuthorizeMiddleware retrieves the security configuration for the matched route and handles the configured authorizations.
No description provided by the author
ContentType wraps a HandlerFunc and checks the incoming content-type with a list of allowed content types.
CorsMiddleware adds Access-Control-Allow-Origin header to responses.
No description provided by the author
No description provided by the author
No description provided by the author
HandleSecureEndpoint creates a new SecurityConfig for the specified endpoint.
No description provided by the author
OpenCensusMiddleware adds request method and path template as span name.
Options takes a list of methods and headers and returns an Options HandlerFunc.
nolint: contextcheck.
TrailingSlashMiddleware removes trailing slash from URL's.

# Constants

No description provided by the author

# Variables

NilResourceFunc represents the Zero Value ResourceFunc.

# Structs

No description provided by the author
SecurityConfig represents how to authenticate and authorize a given endpoint and method.

# Interfaces

No description provided by the author
No description provided by the author

# Type aliases

ResourceFunc takes a *http.Request and returns the resource to use for authorization.