client

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 9 Imported by: 0

README

ZX Authentication Client

Go Report Card Build Status

ZX General gRPC Client for ZXAuth Authentication Server

Usage

package main

import (
	"fmt"
	"os"

	client "github.com/zebraxid/zxauth-client"
)

func main() {

	isUseK8SRegistry := false

	if registry := os.Getenv("MICRO_REGISTRY"); registry != "" {
		if registry == "kubernetes" {
			isUseK8SRegistry = true
		}
	}

	response, err := client.AuthorizeToken("yourtokenhere", isUseK8SRegistry)

	fmt.Println(response, err)
}

Documentation

Index

Constants

View Source
const (
	// AuthService service name for user
	AuthService = "go.micro.srv.auth"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthData

type AuthData struct {
	UserID               string      `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID,omitempty"`
	Token                string      `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	RefreshToken         string      `protobuf:"bytes,3,opt,name=refreshToken,proto3" json:"refreshToken,omitempty"`
	ExpireAt             int64       `protobuf:"varint,4,opt,name=expireAt,proto3" json:"expireAt,omitempty"`
	UserAccess           *UserAccess `protobuf:"bytes,5,opt,name=userAccess,proto3" json:"userAccess,omitempty"`
	Message              string      `protobuf:"bytes,6,opt,name=message,proto3" json:"message,omitempty"`
	OrgID                string      `protobuf:"bytes,7,opt,name=orgID,proto3" json:"orgID,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

func (*AuthData) Descriptor

func (*AuthData) Descriptor() ([]byte, []int)

func (*AuthData) GetExpireAt

func (m *AuthData) GetExpireAt() int64

func (*AuthData) GetMessage

func (m *AuthData) GetMessage() string

func (*AuthData) GetOrgID

func (m *AuthData) GetOrgID() string

func (*AuthData) GetRefreshToken

func (m *AuthData) GetRefreshToken() string

func (*AuthData) GetToken

func (m *AuthData) GetToken() string

func (*AuthData) GetUserAccess

func (m *AuthData) GetUserAccess() *UserAccess

func (*AuthData) GetUserID

func (m *AuthData) GetUserID() string

func (*AuthData) ProtoMessage

func (*AuthData) ProtoMessage()

func (*AuthData) Reset

func (m *AuthData) Reset()

func (*AuthData) String

func (m *AuthData) String() string

func (*AuthData) XXX_DiscardUnknown

func (m *AuthData) XXX_DiscardUnknown()

func (*AuthData) XXX_Marshal

func (m *AuthData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AuthData) XXX_Merge

func (m *AuthData) XXX_Merge(src proto.Message)

func (*AuthData) XXX_Size

func (m *AuthData) XXX_Size() int

func (*AuthData) XXX_Unmarshal

func (m *AuthData) XXX_Unmarshal(b []byte) error

type AuthResponse

type AuthResponse struct {
	AuthData             *AuthData `protobuf:"bytes,1,opt,name=authData,proto3" json:"authData,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

func AuthorizeToken

func AuthorizeToken(token, authServiceAddress string, isUsingK8s bool) (*AuthResponse, error)

AuthorizeToken ..

func (*AuthResponse) Descriptor

func (*AuthResponse) Descriptor() ([]byte, []int)

func (*AuthResponse) GetAuthData

func (m *AuthResponse) GetAuthData() *AuthData

func (*AuthResponse) ProtoMessage

func (*AuthResponse) ProtoMessage()

func (*AuthResponse) Reset

func (m *AuthResponse) Reset()

func (*AuthResponse) String

func (m *AuthResponse) String() string

func (*AuthResponse) XXX_DiscardUnknown

func (m *AuthResponse) XXX_DiscardUnknown()

func (*AuthResponse) XXX_Marshal

func (m *AuthResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AuthResponse) XXX_Merge

func (m *AuthResponse) XXX_Merge(src proto.Message)

func (*AuthResponse) XXX_Size

func (m *AuthResponse) XXX_Size() int

func (*AuthResponse) XXX_Unmarshal

func (m *AuthResponse) XXX_Unmarshal(b []byte) error

type CoreRequest

type CoreRequest struct {
	UserID               string   `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID,omitempty"`
	Password             string   `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	Token                string   `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"`
	RefreshToken         string   `protobuf:"bytes,4,opt,name=refreshToken,proto3" json:"refreshToken,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CoreRequest) Descriptor

func (*CoreRequest) Descriptor() ([]byte, []int)

func (*CoreRequest) GetPassword

func (m *CoreRequest) GetPassword() string

func (*CoreRequest) GetRefreshToken

func (m *CoreRequest) GetRefreshToken() string

func (*CoreRequest) GetToken

func (m *CoreRequest) GetToken() string

func (*CoreRequest) GetUserID

func (m *CoreRequest) GetUserID() string

func (*CoreRequest) ProtoMessage

func (*CoreRequest) ProtoMessage()

func (*CoreRequest) Reset

func (m *CoreRequest) Reset()

func (*CoreRequest) String

func (m *CoreRequest) String() string

func (*CoreRequest) XXX_DiscardUnknown

func (m *CoreRequest) XXX_DiscardUnknown()

func (*CoreRequest) XXX_Marshal

func (m *CoreRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CoreRequest) XXX_Merge

func (m *CoreRequest) XXX_Merge(src proto.Message)

func (*CoreRequest) XXX_Size

func (m *CoreRequest) XXX_Size() int

func (*CoreRequest) XXX_Unmarshal

func (m *CoreRequest) XXX_Unmarshal(b []byte) error

type UserAccess

type UserAccess struct {
	Role                 string   `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
	Permission           []string `protobuf:"bytes,2,rep,name=permission,proto3" json:"permission,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*UserAccess) Descriptor

func (*UserAccess) Descriptor() ([]byte, []int)

func (*UserAccess) GetPermission

func (m *UserAccess) GetPermission() []string

func (*UserAccess) GetRole

func (m *UserAccess) GetRole() string

func (*UserAccess) ProtoMessage

func (*UserAccess) ProtoMessage()

func (*UserAccess) Reset

func (m *UserAccess) Reset()

func (*UserAccess) String

func (m *UserAccess) String() string

func (*UserAccess) XXX_DiscardUnknown

func (m *UserAccess) XXX_DiscardUnknown()

func (*UserAccess) XXX_Marshal

func (m *UserAccess) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UserAccess) XXX_Merge

func (m *UserAccess) XXX_Merge(src proto.Message)

func (*UserAccess) XXX_Size

func (m *UserAccess) XXX_Size() int

func (*UserAccess) XXX_Unmarshal

func (m *UserAccess) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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