security

package
v0.0.0-...-258337a Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Copyright (c) 2021 Cisco Systems, Inc and its affiliates All Rights reserved

Index

Constants

This section is empty.

Variables

View Source
var Security = &msxsecurity.MsxSecurity{}

The Security global will represent the Security validator provided by msx-security.

Functions

func AddSecureRoutes

func AddSecureRoutes(router *mux.Router, routers ...openapi.Router) *mux.Router

AddSecureRoutes adds api routes to an existing router.

func NewEnsureAuth

func NewEnsureAuth(handlerToWrap http.Handler, permission string) http.Handler

NewEnsureAuth will be used to generate an auth wrapper.

func NewSecureRouter

func NewSecureRouter(routers ...openapi.Router) *mux.Router

NewSecureRouter creates a new router for any number of api routers. Routes are secured using our ensure auth wrapper.

func NewSecurity

func NewSecurity(cfg *config.Config) error

Sets up a new Security handler.

func UpdateConfig

func UpdateConfig(c *config.Config, consul *consul.HelloWorldConsul, vault *vault.HelloWorldVault) error

Override configuration with values from Consul and Vault.

Types

type EnsureAuth

type EnsureAuth struct {
	// contains filtered or unexported fields
}

EnsureAuth will wrap http handle funcs that require auth.

func (*EnsureAuth) ServeHTTP

func (ea *EnsureAuth) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP will perform the auth on behalf of the embedded handlerfunc.

Jump to

Keyboard shortcuts

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