gobware

package module
v0.0.0-...-5f4dff7 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 13 Imported by: 1

README

Gobware

Gobware is a software package implemented in Go, designed to simplify and enhance web development tasks. It provides a set of tools and functionalities to strengthen the security and access control of web applications.

Features

  1. Web Token Security
    Gobware includes robust web token security mechanisms. Tokens are used to securely transmit information between parties as JSON objects, providing a stateless and secure way of handling user authentication and authorization. It enables secure and reliable user sessions without the need for server-side storage.

  2. Access Control Lists (ACL)
    With built-in Access Control Lists, Gobware enables control over user access to various resources and actions within the web application. Administrators can define access rules based on roles and permissions, ensuring that each user has appropriate access privileges.


Cross-Language Compatibility via gRPC
Gobware is designed to promote cross-language compatibility through the use of gRPC. This means you can seamlessly integrate Gobware with services written in Python, Node.js, Java, C++, and more.


Getting Started
To start using Gobware in your Go web application, follow these steps:

Install Gobware using go get github.com/GHHag/gobware.

Import Gobware in your Go code: import "github.com/GHHag/gobware".

Utilize the various tools and functionalities of Gobware in your web application to enhance security and streamline development.


Contributing
We welcome contributions from the community to improve and expand Gobware. If you find any bugs, issues, or have feature requests, please feel free to open an issue or submit a pull request on our GitHub repository.


License
Gobware is released under the MIT License. You are free to use, modify, and distribute the package in compliance with the license terms.

This README file is a high-level description of the Gobware package, outlining its key features and functionalities. The actual implementation can be found in the project's source code. The provided description serves as an introduction to the software package, encouraging users to explore and leverage its web development tools for secure and efficient web applications in Go.


Future package features may include the following:
Caching services

Request rate limiting

SSE/web socket functionality

Pub/Sub event management

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessTokenKey

func AccessTokenKey() string

func Adapt

func Adapt(hf http.HandlerFunc, adapters ...HandlerFuncAdapter) http.HandlerFunc

func AttemptTokenExchange

func AttemptTokenExchange(accessToken string, refreshToken string, expires time.Time) (string, string, error)

func BakeCookie

func BakeCookie(name string, value string, expires time.Time) *http.Cookie

func GenerateRandomByteArray

func GenerateRandomByteArray(length int) ([]byte, error)

func HashData

func HashData(algorithm Algorithm, data []byte, salt []byte, pepper []byte) []byte

func NewACL

func NewACL(roleKey string) *acl

func NewToken

func NewToken(expires time.Time, data map[string]string) (string, error)

func NewTokenPair

func NewTokenPair(expires time.Time, data map[string]string) (string, string, error)

func RefreshTokenKey

func RefreshTokenKey() string

func TokenDuration

func TokenDuration() time.Duration

func VerifyData

func VerifyData(algorithm Algorithm, data []byte, salt []byte, pepper []byte, hash []byte) bool

func VerifyToken

func VerifyToken(encodedSignedToken string) (bool, token, error)

Types

type Algorithm

type Algorithm func([]byte) [32]byte

type Configuration

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

func (*Configuration) AddACLRule

func (config *Configuration) AddACLRule(role string, route string, httpMethods []string)

func (*Configuration) CheckAccess

func (config *Configuration) CheckAccess(userData map[string]string, route string, httpMethod string) bool

func (*Configuration) SetACL

func (config *Configuration) SetACL(acl *acl)

type CreateToken

type CreateToken func(time.Time, map[string]string) (string, error)

type CreateTokenPair

type CreateTokenPair func(time.Time, map[string]string) (string, string, error)

type HandlerFuncAdapter

type HandlerFuncAdapter func(http.HandlerFunc) http.HandlerFunc

func CheckAccess

func CheckAccess(config Configuration) HandlerFuncAdapter

func CheckToken

func CheckToken() HandlerFuncAdapter

func GenerateToken

func GenerateToken(requestToken RequestToken) HandlerFuncAdapter

func GenerateTokenPair

func GenerateTokenPair(requestTokenPair RequestTokenPair) HandlerFuncAdapter

type RequestToken

type RequestToken func(*http.Request, time.Time, CreateToken) (string, error)

type RequestTokenPair

type RequestTokenPair func(*http.Request, time.Time, CreateTokenPair) (string, string, error)

Jump to

Keyboard shortcuts

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