asession

package
v0.0.0-...-c2d9d29 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: 5 Imported by: 0

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, path, idp, ta, rediUri, stat, nonc string) *Element

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) IdProvider

func (this *Element) IdProvider() string

func (*Element) Invalid

func (this *Element) Invalid() bool

無効にされているかどうか。

func (*Element) Invalidate

func (this *Element) Invalidate()

無効にする。

func (*Element) MarshalJSON

func (this *Element) MarshalJSON() (data []byte, err error)
{
    "id": <ID>,
    "invalid": <無効か>,
    "expires": <有効期限>,
    "path": <リクエストパス>,
    "id_provider": <ID プロバイダの ID>,
    "client_id": <TA としての ID>,
    "redirect_uri": <リダイレクトエンドポイント>,
    "state": <state 値>,
    "nonce": <nonce 値>
}

func (*Element) Nonce

func (this *Element) Nonce() string

func (*Element) Path

func (this *Element) Path() string

パスを返す。

func (*Element) RedirectUri

func (this *Element) RedirectUri() string

func (*Element) State

func (this *Element) State() string

func (*Element) Ta

func (this *Element) Ta() 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