[Midas] authenticated access

Zach Mullen zach.mullen at kitware.com
Mon Jun 25 15:15:39 EDT 2012


On Mon, Jun 25, 2012 at 3:06 PM, Mona Wong <mona at sdsc.edu> wrote:

>
> Ah, but my application will be launched by different users from Midas.
>  How can I programmatically get the user's API key and pass that info to my
> app so it can retrieve data from and put data back to the user's Midas
> account?
>
> Mona
>

Sorry, I didn't realize you were talking about from within your module.  If
you have the user DAO, and want to know that user's default API key, you
would do the following:

$user = $this->userSession->Dao;  // get the DAO from the current session
user
$modelLoader = new MIDAS_ModelLoader(); //instantiate the model loader
object
$userApiModel = $modelLoader->loadModel('Userapi', 'api'); //load the model
for the user api keys
$defaultApiKey = $userApiModel->getByAppAndUser('Default', $user);
//retrieve the default api key for the current user

Hope this helps,

-Zach

>
> On Jun 25, 2012, at 12:02 PM, Zach Mullen wrote:
>
> Each user has a "Default" web API key that is generated for them when
> their user is first made, and it changes when the user changes their
> password.  You can use that token to authenticate as that user.
>
> To see your user's default key, go to the top menu for your user (under
> your name) and click "My Account".  In the area that appears at the top,
> click the "Api" tab.  The "Default" api key will be listed there, as in the
> screenshot attached.
>
> You can then use that within Pydas or whichever Midas client you plan to
> use.
>
> Thanks,
>
> Zach
>
> On Mon, Jun 25, 2012 at 2:57 PM, Mona Wong <mona at sdsc.edu> wrote:
>
>>
>> Hi Patrick:
>>
>>        And how does my application get this Midas API key?  Is there a
>> module that does this I can look at?
>>
>> thanks,
>> Mona
>>
>>
>
>  <apikey.png>
>
>
>  *********************************************
>     Mona Wong
>     Web & iPad Application Developer
>     San Diego Supercomputer Center
>
>     You are the light you wish to see.
> *********************************************
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/midas/attachments/20120625/1e3e22cb/attachment.html>


More information about the Midas mailing list