Skip to content

nanzhong/oktaauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Okta Auth

Small and simple drop in utils for handling Okta auth.

OAuth handler

This handler is an easy way to put Okta OAuth in front of endpoints.

import "github.com/nanzhong/oktaauth"

var (
    sessionKey   []byte
    clientID     string
    clientSecret string
    issuer       string
    redirectURI  string
    preservePath bool
    errorWriter  func(w http.ResponseWriter, r *http.Request, err error, status int)
)

// ...

oaHandler, err := oktaauth.NewAuthHandler(sessionKey, clientID, clientSecret, issuer, redirectURI, WithPreservePath(true), WithErrorWriter(errorWriter))

// ...

http.HandleFunc("/oauth/callback", oaHandler.AuthCodeCallbackHandler)
http.HandleFunc("/", oaHandler.Ensure(realRouteHandler))
http.HandleFunc("/logout", oaHandler.ClearSessionHandler)

About

Simple Okta Auth utils

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages