authcode

package
v0.0.0-...-72324ba Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2015 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

type Db interface {
	// 取得。
	Get(id string) (*Element, error)

	// 保存。
	// exp: 保存期限。この期間以降は Get や Replace できなくて良い。
	Save(elem *Element, exp time.Time) error

	// 上書き。
	// savedDate が保存されている要素の更新日時と同じでなければ失敗する。
	Replace(elem *Element, savedDate time.Time) (ok bool, err error)
}

認可コード情報の格納庫。

func NewMemoryDb

func NewMemoryDb() Db

func NewRedisDb

func NewRedisDb(pool *redis.Pool, tag string) Db

redis による認可コード情報の格納庫。 本体と別に更新日時を、日時タグと ID をキーにして、Unix 時間 (ナノ秒) で格納。 RFC3339 じゃない理由は同値比較でタイムゾーンを考えたくないから。

type Element

type Element struct {
	// contains filtered or unexported fields
}

認可コード情報。

func New

func New(id string, exp time.Time, acnt string, lginDate time.Time, scop, idTokAttrs,
	acntAttrs map[string]bool, ta, rediUri, nonc string) *Element

func (*Element) Account

func (this *Element) Account() string

アカウント ID を返す。

func (*Element) AccountAttributes

func (this *Element) AccountAttributes() map[string]bool

アカウント情報エンドポイントでの提供可能属性を返す。

func (*Element) Date

func (this *Element) Date() time.Time

更新日時を返す。

func (*Element) Expires

func (this *Element) Expires() time.Time

有効期限を返す。

func (*Element) Id

func (this *Element) Id() string

ID を返す。

func (*Element) IdTokenAttributes

func (this *Element) IdTokenAttributes() map[string]bool

ID トークンでの提供可能属性を返す。

func (*Element) LoginDate

func (this *Element) LoginDate() time.Time

ログイン日時を返す。

func (*Element) MarshalJSON

func (this *Element) MarshalJSON() (data []byte, err error)
{
    "id": <ID>,
    "expires": <有効期限>,
    "account": <アカウント ID>,
    "login_date": <ログイン日時>,
    "scope": [
        <許可スコープ>,
        ...
    ],
    "id_token": [
        <ID トークンでの許可属性>,
        ...
    ],
    "userinfo": [
        <アカウント情報エンドポイントでの許可属性>,
    ],
    "client_id": <TA の ID>,
    "redirect_uri": <リダイレクトエンドポイント>,
    "nonce": <nonce 値>,
    "token": <アクセストークン>,
    "date": <更新日時>
}

func (*Element) Nonce

func (this *Element) Nonce() string

元になったリクエストの nonce を返す。

func (*Element) RedirectUri

func (this *Element) RedirectUri() string

元になったリクエストの redirect_uri を返す。

func (*Element) Scope

func (this *Element) Scope() map[string]bool

許可スコープを返す。

func (*Element) SetToken

func (this *Element) SetToken(tok string)

発行したアクセストークンを保存する。

func (*Element) Ta

func (this *Element) Ta() string

TA の ID を返す。

func (*Element) Token

func (this *Element) Token() string

発行したアクセストークンを返す。

func (*Element) UnmarshalJSON

func (this *Element) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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