Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/0x4139/ginauthentication

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/0x4139/ginauthentication

  • v0.0.0-20151116142716-573501ff8898
  • Source
  • Go
  • Socket score

Version published
Created
Source

=== This implements a basic authentication engine and middleware for gin-web-framework

Instalation

go get github.com/0x4139/ginAuthentication

Tests

No tests were written :( sorry

go 

Usage

package ginAuthentication

import (
"github.com/gin-gonic/gin"
"time"
)

func main() {
	r := gin.New()
	authEngine,_:=New(AuthenticationEngine{
		aesKey:[]byte("a very very very very secret key") /*32 bytes*/,
		cookieExpirationTime:5*time.Hour,
		cookieName:"gin-auth",
		fn:func (authenticationCredentials) (valid bool,err error){
			return true,nil//authenticate any user
		}})
	r.Use(authEngine.ValidationMiddleware("/not/authenticated/route"))
	r.POST("/authenticate", func(c *gin.Context) {
		authEngine.ValidateAndSetCookie(authenticationCredentials{username:c.Get("username"),password:c.Get("password")},c)
	})

	r.Run(":8080") // listen and serve on 0.0.0.0:8080
}

TODO

More tests send pull requests please, love them

FAQs

Package last updated on 16 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc