session

package
v0.0.0-...-0ba3bd2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxHistory = 5

過去に選択された IdP をいくつまで記憶するか。 最後に選択された IdP も含む。

Functions

This section is empty.

Types

type Db

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

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

セッションの格納庫。

func NewMemoryDb

func NewMemoryDb() Db

func NewRedisDb

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

redis によるセッションの格納庫。

type Element

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

セッション。

func New

func New(id string, exp time.Time) *Element

func (*Element) Clear

func (this *Element) Clear()

一時データを消す。

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

最後に選択された IdP の ID を返す。

func (*Element) Language

func (this *Element) Language() string

最後に選択された表示言語を返す。

func (*Element) MarshalJSON

func (this *Element) MarshalJSON() (data []byte, err error)
{
    "id": <ID>,
    "expires": <有効期限>,
    "issuer": <ID プロバイダ>,
    "query": <リクエスト内容>,
    "ticket": <チケット>,
    "past_issuers": [
        <選択したことのある ID プロバイダ>,
        ...
    ],
    "locale": <表示言語>
}

func (*Element) New

func (this *Element) New(id string, exp time.Time) *Element

履歴を引き継いだセッションを作成する。

func (*Element) Query

func (this *Element) Query() string

現在のリクエスト内容を返す。

func (*Element) Saved

func (this *Element) Saved() bool

読み込まれたセッションかどうか。

func (*Element) SelectIdProvider

func (this *Element) SelectIdProvider(idp string)

IdP が選択されたことを反映させる。

func (*Element) SelectedIdProviders

func (this *Element) SelectedIdProviders() []string

過去に選択された IdP の ID を返す。

func (*Element) SetLanguage

func (this *Element) SetLanguage(lang string)

表示言語を保存する。

func (*Element) SetQuery

func (this *Element) SetQuery(query string)

リクエスト内容を保存する。

func (*Element) SetTicket

func (this *Element) SetTicket(tic *ticket.Ticket)

チケットを保存する。

func (*Element) Ticket

func (this *Element) Ticket() *ticket.Ticket

現在発行されているチケットを返す。

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