defaultauth

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2020 License: MIT Imports: 8 Imported by: 1

README

Default authorizaton module used on GoAuth2

Go Report Card

Can interface with any GoAuth2 proxy for any type of authentication service. GoAuth2Users meets all of the requirements below for a GoAuth2 Proxy.

Any GoAuth2 Proxy service must meet the following requirement:

The GoAuth2 Proxy must implement the code inside the "login" service to interface with the target authentication service.

Validate User
Method: POST

URL: http://proxyURL/rs/user/login

Request headers Example:

Content-Type = application/json

Request Body Example:

{
   "username":"admin",
   "password":"admin",
   "clientId":10   
}

Response:

{
    "valid": true,
    "code": "10"
}

Usage


import (
	px "github.com/Ulbora/GoProxy"
	au "github.com/Ulbora/auth_interface"
	"testing"
)

var authURL = "http://localhost:3001/rs/user/login"

var proxy px.GoProxy

var login au.Login
login.Username = "admin"
login.Password = "admin"
login.ClientID = 10

var da DefaultAuth
da.AuthServerURL = authURL
da.Proxy = proxy.GetNewProxy()
ai := da.GetNew()
val := ai.UserLogin(&login)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultAuth

type DefaultAuth struct {
	Proxy         px.Proxy
	AuthServerURL string
}

DefaultAuth DefaultAuth

func (*DefaultAuth) GetNew

func (m *DefaultAuth) GetNew() au.AuthInterface

GetNew GetNew

func (*DefaultAuth) UserLogin

func (m *DefaultAuth) UserLogin(login *au.Login) bool

UserLogin UserLogin

type LoginRes

type LoginRes struct {
	Valid bool   `json:"valid"`
	Code  string `json:"code"`
}

LoginRes LoginRes

type MockDefaultAuth

type MockDefaultAuth struct {
	Proxy         px.Proxy
	AuthServerURL string
	MockValid     bool
}

MockDefaultAuth MockDefaultAuth

func (*MockDefaultAuth) GetNew

func (m *MockDefaultAuth) GetNew() au.AuthInterface

GetNew GetNew

func (*MockDefaultAuth) UserLogin

func (m *MockDefaultAuth) UserLogin(login *au.Login) bool

UserLogin UserLogin

Jump to

Keyboard shortcuts

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