New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widgetize: giving access to everybody to view a specific widget (token_auth on a per widget basis) #5703

Open
mattab opened this Issue Jul 6, 2008 · 12 comments

Comments

Projects
None yet
6 participants
@mattab
Member

mattab commented Jul 6, 2008

At the moment, users can only export widgets if they have made their statistics publicly available. Often, people would be happy to share their number of visits (and show the evolution graph over the last 30 days for example), but they don’t want to share other data (keywords, referers, etc.).

At the moment widgets are shown only if stats are avaialble for the anonymous user, or if the user passes its token_auth to the widget. This is a problem as currently token_auth is like having the login + password.

Proposal

- each website is associated with a website_key that has VIEW access to the website data.
- this key is the one passed for invoking the widgets.
- it is expected that this key is Known to external users. Having this key means that all the website reports are readable.
- during Authentication, in: /plugins/Login/Auth.php there will be a new sql query to select from piwik_site and try and match a website key; if matched, the login used is anonymous. anonymous user has read access but no write access (you can’t create websites, users, goals, etc.).

Specification

- DB changes: new token_auth field of 32 chars in piwik_site
- Migration: this token_auth must be randomly generated for all existing websites during migration.
- API: the token_auth is now returned in the website responses from the SitesManager API, eg. in SitesManager.getSiteFromId(). When adding a new website, the token_auth must be generated.
- Authentication: should be a small change in plugins/Login/Auth.php. Side note: we make sure that when the token_auth is empty in the DB (in case of migration issue for example), the authentication fails.
- UI: the website_key is now added to all widgets embed fields URLs (for flash invocation, and iframe invocation)

Downside

The downside of this method is that the website_key is available to see all widgets for a website. This is rather open and will be an issue for some websites which will claim that it is not ok to open all the reports to everyone. The alternative would be to have a md5 hash generated for each tuple (widget, website), the Auth would then look in this list to authenticate.

if anyone is interested and wants to build this feature, let us know in the comments

@anonymous-piwik-user

This comment has been minimized.

Show comment
Hide comment
@anonymous-piwik-user

anonymous-piwik-user Jun 11, 2009

I'd like to allow the Drupal user to save it's own token_auth in his Drupal user settings. If the User take a look on the reports all the reports need to be accessed with the token_auth. This solution is much better than opening the full system for all anonymous users.

Today this seems not working. If I read the above it should work... sounds like something is broken.

Additional to my "quick" solution it would be great to have the ability to define what widget is accessible by anonymous users.

anonymous-piwik-user commented Jun 11, 2009

I'd like to allow the Drupal user to save it's own token_auth in his Drupal user settings. If the User take a look on the reports all the reports need to be accessed with the token_auth. This solution is much better than opening the full system for all anonymous users.

Today this seems not working. If I read the above it should work... sounds like something is broken.

Additional to my "quick" solution it would be great to have the ability to define what widget is accessible by anonymous users.

@robocoder

This comment has been minimized.

Show comment
Hide comment
@robocoder

robocoder Jul 2, 2009

Contributor

Escalating urgency of resolution.

A better(?) "token_auth" might be: md5(token_auth . widgetName), as it would not require an external site to store a copy of the Piwik user login & password.

Contributor

robocoder commented Jul 2, 2009

Escalating urgency of resolution.

A better(?) "token_auth" might be: md5(token_auth . widgetName), as it would not require an external site to store a copy of the Piwik user login & password.

@anonymous-piwik-user

This comment has been minimized.

Show comment
Hide comment
@anonymous-piwik-user

anonymous-piwik-user Jul 2, 2009

Also an issue on API calls. Keep in mind that the Drupal Piwik Reports module attaches the token_auth to the JSON URLs to get JSON data that will be processed in a loop to build a HTML table and fill it with the data I receive from Piwik. This is "Ajax" with an auth key.

anonymous-piwik-user commented Jul 2, 2009

Also an issue on API calls. Keep in mind that the Drupal Piwik Reports module attaches the token_auth to the JSON URLs to get JSON data that will be processed in a loop to build a HTML table and fill it with the data I receive from Piwik. This is "Ajax" with an auth key.

@anonymous-piwik-user

This comment has been minimized.

Show comment
Hide comment
@anonymous-piwik-user

anonymous-piwik-user commented Jul 2, 2009

See here how this works (I'm grabbing the URL with token_auth from a plain text value in source code):

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/piwik/modules/piwik_reports/piwik_reports.js?revision=1.1.2.9&view=markup&pathrev=DRUPAL-6--1

@mattab

This comment has been minimized.

Show comment
Hide comment
@mattab

mattab Jul 8, 2009

Member

(In [1300]) moving auth refs #5703

Member

mattab commented Jul 8, 2009

(In [1300]) moving auth refs #5703

@anonymous-piwik-user

This comment has been minimized.

Show comment
Hide comment
@anonymous-piwik-user

anonymous-piwik-user Jan 27, 2010

i didnt find this old ticket via search
accidently opened a new one under #1126

anyway - i described pretty much the same problem
it would be awesome if i'd get into one of the next releases in order to actually use widgets without releasing ALL statistics (which is not a very good idea after all) to the public.

anonymous-piwik-user commented Jan 27, 2010

i didnt find this old ticket via search
accidently opened a new one under #1126

anyway - i described pretty much the same problem
it would be awesome if i'd get into one of the next releases in order to actually use widgets without releasing ALL statistics (which is not a very good idea after all) to the public.

@anonymous-piwik-user

This comment has been minimized.

Show comment
Hide comment
@anonymous-piwik-user

anonymous-piwik-user Feb 11, 2010

I definitely love to have this feature. I am building a web app that using piwik to show the statistics widgets to the users. Let me know if I can help in anything.

anonymous-piwik-user commented Feb 11, 2010

I definitely love to have this feature. I am building a web app that using piwik to show the statistics widgets to the users. Let me know if I can help in anything.

@mattab

This comment has been minimized.

Show comment
Hide comment
@mattab

mattab Mar 4, 2010

Member

nass you are right. Until this feature is implemented, we should at least allow token_auth authentication in Widgetize calls, to allow widgets to be displayed with the token_auth of a user with view permissions. I reopened #235

Member

mattab commented Mar 4, 2010

nass you are right. Until this feature is implemented, we should at least allow token_auth authentication in Widgetize calls, to allow widgets to be displayed with the token_auth of a user with view permissions. I reopened #235

@mattab

This comment has been minimized.

Show comment
Hide comment
@mattab

mattab Mar 30, 2010

Member

token_auth works with widgets, postponing this feature request to later

Member

mattab commented Mar 30, 2010

token_auth works with widgets, postponing this feature request to later

@DaSchTour

This comment has been minimized.

Show comment
Hide comment
@DaSchTour

DaSchTour Mar 19, 2013

Contributor

+1
with the realtime map widget this would be a great feature
please add this soon

Contributor

DaSchTour commented Mar 19, 2013

+1
with the realtime map widget this would be a great feature
please add this soon

@halfdan

This comment has been minimized.

Show comment
Hide comment
@halfdan

halfdan Sep 2, 2013

Member

@vipsoft: md5(token_auth . widgetName) is not a good solution. If you change your password, all shared widgets will become invalid. We should generate a new random access key on a per widget basis.

Member

halfdan commented Sep 2, 2013

@vipsoft: md5(token_auth . widgetName) is not a good solution. If you change your password, all shared widgets will become invalid. We should generate a new random access key on a per widget basis.

@mattab mattab removed this from the Long term milestone Dec 5, 2016

@Findus23

This comment has been minimized.

Show comment
Hide comment

@mattab mattab removed the Lower priority label Sep 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment