Service_Authenticationでの値保存につきまして

3 views
Skip to first unread message

katarou

unread,
Dec 3, 2007, 12:43:34 AM12/3/07
to Piece Framework Users (ja)
田川です。

Authenticationプラグインについて教えてください。

認証後に、たとえば、認証されたユーザのIDを取得したい場合は、
処理の中で
認証時:
$authentication->_state->_statesByRealm['_default']['userid'] =$this-
>_user->userid;
で登録し、

呼び出し:
$authentication = &new Piece_Unity_Service_Authentication();
$authenticatedUseid = $authentication->_state-
>_statesByRealm['_default']['userid];
という風に書けばよいでしょうか?

現在上記方法にて取得できているのですが、ほかに良い方法をご存じであれば、
ご教授いただけますか?

以上、よろしくお願いいたします。

KUBO Atsuhiro

unread,
Dec 6, 2007, 5:30:53 AM12/6/07
to piece-framew...@googlegroups.com
久保です。

katarou さんは書きました:

まず Piece_Unity_Service_Authentication は認証状態へのインタフェースを
提供するものであり、ユーザ情報などを保持するものではありません。

アプリケーション全体でユーザ情報など共有したい場合は、セッション変数を
使うのが正解です。

設定:
$this->_context->getSession()->setAttribute('user', $this->_user);

取得:
$user = $this->_context->getSession()->getAttribute('user');

--
KUBO Atsuhiro e-mail: ku...@iteman.jp

katarou

unread,
Dec 6, 2007, 5:39:44 AM12/6/07
to Piece Framework Users (ja)
田川です。

了解しました。
ありがとうございます。
> KUBO Atsuhiro e-mail: k...@iteman.jp- 引用テキストを表示しない -
>
> - 引用テキストを表示 -
Reply all
Reply to author
Forward
0 new messages