router

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 26, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOpenPath

func AddOpenPath(path string)

AddOpenPath adds a path to the list of open paths.

func AddRoles

func AddRoles(path string, requiredRoles ...string)

AddRoles associates a path with required roles.

func GetRolesForPath

func GetRolesForPath[T goservectx.Principal](ctx goservectx.Request[T]) ([]string, bool)

GetRolesForPath retrieves the roles associated with a request path.

This function takes the API request context and determines the roles required for accessing the specified path. The roles are matched based on predefined patterns or exact path matches.

Parameters:

ctx - The API request context containing request metadata.

Returns:

[]string - A slice of required roles for the path or nil if no roles are defined.
bool - True if roles are required for the path, false otherwise.

func IsPublicPath

func IsPublicPath[T goservectx.Principal](ctx goservectx.Request[T]) bool

IsPublicPath checks if the provided path is registered as a public route.

This function takes the API request context and verifies whether the current request path matches any registered public routes. Public routes are those that do not require any roles to access.

Parameters:

ctx - The API request context containing request metadata.

Returns:

bool - True if the path is a public route, false otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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