esia

package module
v0.0.0-...-9099a10 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2018 License: GPL-3.0 Imports: 14 Imported by: 0

README

esia

Esia openId

esiaOpenId := &esia.OpenId{  
      Config: esia.ConfigOpenId{  
              MnemonicsSystem:"000000",  
              RedirectUrl:"https://site/esia",  
              PortalUrl:"https://esia-portal1.test.gosuslugi.ru/",  
              //PortalUrl:"https://esia.gosuslugi.ru/",  
              PrivateKeyPath:"/path/to/esia_auth.key",  
              PrivateKeyPassword:"",  
              CertPath:"/path/to/esia_auth.pem",  
              TmpPath:"/path/to/tmp",  
              Scope:"fullname id_doc",  
              CodeUrl :"aas/oauth2/ac",  
              TokenUrl :"aas/oauth2/te",  
      },  
}

//Get auth url
url, _ := esiaOpenId.GetUrl()

//Get persone info
var person esia.EsiaPerson
esiaOpenId.GetInfoByPath("", &person)

//Get docs info
var docs esia.EsiaDocs
esiaOpenId.GetInfoByPath("/docs/" + fmt.Sprint(person.RIdDoc), &docs)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigOpenId

type ConfigOpenId struct {
	MnemonicsSystem    string
	RedirectUrl        string
	PortalUrl          string
	PrivateKeyPath     string
	PrivateKeyPassword string
	CertPath           string
	TmpPath            string
	Scope              string
	CodeUrl            string
	TokenUrl           string
}

type EsiaAuthCode

type EsiaAuthCode struct {
	Nbf          string `json:"-"`
	Scope        string `json:"scope"`
	Iss          string `json:"iss"`
	UrnEsiaSid   string `json:"urn:esia:sid"`
	UrnEsiaSbjId int32  `json:"urn:esia:sbj_id"`
	Iat          int32  `json:"iat"`
	ClientId     string `json:"client_id"`
	Exp          int32  `json:"exp"`
}

type EsiaDocs

type EsiaDocs struct {
	Id        int32  `json:"id"`
	Type      string `json:"type"`
	VrfStu    string `json:"vrfStu"`
	Series    string `json:"series"`
	Number    string `json:"number"`
	IssueDate string `json:"issueDate"`
	IssueId   string `json:"issueId"`
	IssuedBy  string `json:"issuedBy"`
	Etag      string `json:"eTag"`
}

type EsiaPerson

type EsiaPerson struct {
	FirstName         string `json:"firstName"`
	LastName          string `json:"lastName"`
	MiddleName        string `json:"middleName"`
	Trusted           bool   `json:"trusted"`
	Citizenship       string `json:"citizenship"`
	Status            string `json:"status"`
	Verifying         bool   `json:"verifying"`
	RIdDoc            int32  `json:"rIdDoc"`
	ContainsUpCfmCode bool   `json:"containsUpCfmCode"`
	ETag              string `json:"eTag"`
}

type EsiaToken

type EsiaToken struct {
	AccessToken  string       `json:"access_token"`
	AuthCode     EsiaAuthCode `json:"-"`
	RefreshToken string       `json:"refresh_token"`
	State        string       `json:"state"`
	TokenType    string       `json:"token_type"`
	ExpiresIn    int32        `json:"expires_in"`
}

type OpenId

type OpenId struct {
	Config ConfigOpenId
	Token  string
	Oid    int32
}

func (*OpenId) GetInfoByPath

func (c *OpenId) GetInfoByPath(path string, item interface{}) error

func (*OpenId) GetState

func (c *OpenId) GetState() (string, error)

func (*OpenId) GetTimeStamp

func (c *OpenId) GetTimeStamp() string

func (*OpenId) GetTokenState

func (c *OpenId) GetTokenState(code string) (EsiaToken, error)

func (*OpenId) GetUrl

func (c *OpenId) GetUrl() (string, error)

func (*OpenId) Sign

func (c *OpenId) Sign(message string) (string, error)

Jump to

Keyboard shortcuts

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