Web サービスのいくつかのメソッドの認証システムを作成しようとすると問題が発生します。私は uuid (セッション トークン) を作成し、このような xml に入れたいと思っています。他の関数を使用しているときは、このトークンを認証に再利用します。
次のような関数を作成します。
<cffunction name="myfunction" access="remote" returntype="xml">
<cfargument name="user" type="string" required="true">
<cfargument name="pwdtype="string" required="true">
//LOGIN HERE and test if myuser is ok
<cfif local.myuser.recordcount is 1>
<cfxml variable="local.myresult"><cfoutput>
<myxml>
<response type="myresponse">
<message>Autenticazione effettuata correttamente</message>
<dati>
<idtoken>#session.urltoken#</idtoken>
<iduser>#local.myuser.iduser# </iduser>
</dati>
</response>
</myxml>
</cfoutput></cfxml>
</cfif>
</cffunction>
私の質問は次のとおりです。次の行のように、再テスト認証のためにセッションを取得するにはどうすればよいですか?
if session.mytoken is session.realtoken