fiwarefiware-wirecloud

FIWARE how to access KeyRock IdM token from Wirecloud widget


In the global Wirecloud instance i have a widget which uses the KeystoneAPI mentioned here: https://wirecloud.readthedocs.io/en/stable/development/object_storage_api/

So far so good.

However now i want to move to KeyRock for authentication. I still want to pass tokens from my wirecloud widget to backend services like the Wilma PEP proxy which is not connected to KeyRock as well. But the KeystoneAPI seems to be tied to Keystone (hence the name probably).

Is there a KeyRockAPI accessible from Wirecloud widgets? How can a widget obtain the KeyRock OAuth2 token the user logged in with? I cannot find any documentation on this.


Solution

  • WireCloud doesn't allow widgets and operators to read the OAuth2 token assigned to the user, but it provide support for injecting the token into HTTP requests if they go through the WireCloud's proxy. This injection is controlled by several HTTP headers, this is an example:

    MashupPlatform.http.makeRequest(url, {
        requestHeaders: {
            "X-FI-WARE-OAuth-Token": "true",
            "X-FI-WARE-OAuth-Header-Name": "X-Auth-Token"
        },
        ...
    });
    

    You can find more info about how to use this feature in the FIWARE Academy course, more specifically in the 3.1.8. Accessing third-party services using IdM tokens section (take into account that this document is the same you pointed in your comments, but in html format ;) ).

    Answers to the others questions formulated as comments: