Pending

User tests: Successful: Unsuccessful:

avatar elkuku
elkuku
25 Jan 2013

This will add the possibility to authenticate a user with his/her GitHub account using oAuth for authentication.

More than a possibility, it's a requirement - to be discussed ?

Currently supported:

  • Login.
  • Posting comments.

Testing login

In order to test the login feature in your local environment you will need to create an application key and secret for your (local) JTrackerApplication instance:

  • Sail to your account on GitHub ⇒ "Edit your Profile".
  • Go to "Applications" - "Developer applications" and "Register new application"
  • Fill in some name and some main url. Those will be presented to the user when authorizing the application.
  • Fill in a domain for callback URL. This must match the domain the application is running.
    Hint This may be http://localhost or a virtual host.
  • Hit "Save" and copy the client_id and client_secret.
  • Checkout the branch at https://github.com/JTracker/jissues/tree/github-auth
  • Edit configuration.php and fill in the client_id and client_secret.
  • Install as usual.
  • Sail to your localhosts JTracker installation and click on "Login with GitHub"
  • On the first attempt you will be redirected to GitHub where you have to confirm the access by your application.
  • After a successful login, go to "Users" ⇒ "View Profile".
    You may also try "Edit Profile", but saving is currently disabled.

Testing comments

Commenting is actually enabled only for the a project - to avoid spam...
This project is a "real" (testing) project located at: https://github.com/jtester/tests/
Note: GitHub allows the creation of "unconfirmed" accounts, so you may want to create a dummy user to avoid spamming your followers ;)

So if you have installed with the sql file from the branch you should see three projects.

  • Run retrieveissues.php and retrievecomments.php for project No. 3.

  • Log out.

  • Select the project JTestS.

  • Choose an issue.

  • Click "Login with GitHub to add a comment" at the bottom of the comments section.

  • A comment field should appear.

  • Post a comment.

  • Verify that the comment appears both on GitHub and in the application.

    Note that this step will required the PHP exec() function to be enabled on your server, since I was lazy ;) - but this may change.

I admit that the code used for obtaining the oAuth token is far from being beautiful.
But since those are only about three lines of working code, we may wait to see what the platform will offer us in the future regarding oAuth authentication.

avatar elkuku elkuku - open - 25 Jan 2013
avatar elkuku elkuku - open - 25 Jan 2013
avatar elkuku elkuku - reference | - 25 Jan 13
avatar TobsBobs
TobsBobs - comment - 25 Jan 2013

Hello,

I tested this PR and get the following error message:

Warning (!): Sprintf () [<a href='function.sprintf'> function.sprintf </ a>]: Too few arguments in C: \ wamp \ www \ git-auth \ libraries \ joomla \ language \ text . php on line 246
Call Stack
# Time Memory Function Location
1 0.0003 672200 {main} () .. \ index.php: 0
2 0.0343 4741872 JApplicationWeb-> execute () .. \ index.php: 24
3 0.0343 4741872 JApplicationTracker-> doExecute () .. \ in Unknown: 247
4 0.0770 5558304 JApplicationTracker-> executeComponent () .. \ tracker.php: 255
5 0.0794 5636840 UsersControllerGhlogin-> execute () .. \ tracker.php: 330
6 1.5736 7437520 User Registration Model-> register () .. \ ghlogin.php: 83
7 1.8128 9711832 JText :: sprintf () .. \ registration.php: 469
8 1.8128 9712984 call_user_func_array () .. \ text.php: 246

(!) Fatal error: Call to undefined function curl_init () in C: \ wamp \ www \ git-auth \ components \ com_users \ controllers \ ghlogin.php on line 117
Call Stack
# Time Memory Function Location
1 0.0003 672200 {main} () .. \ index.php: 0
2 0.0343 4741872 JApplicationWeb-> execute () .. \ index.php: 24
3 0.0343 4741872 JApplicationTracker-> doExecute () .. \ in Unknown: 247
4 0.0770 5558304 JApplicationTracker-> executeComponent () .. \ tracker.php: 255
5 0.0794 5636840 UsersControllerGhlogin-> execute () .. \ tracker.php: 330
6 1.8131 9704064 UsersControllerGhlogin-> save avatar () .. \ ghlogin.php: 90

What is wrong? Thanks for your answers and I wish you a nice evening.

greeting
Tobi

avatar elkuku
elkuku - comment - 26 Jan 2013

OK, the warning is about missing language files (my fault)
The fatal is about cUrl not available on the server - also my fault as I missed a check.
Since this is a request I have not been able to do with JHttp - could you enable cUrl (they say it goes like this) OR just put a return true at the beginning of the function ?

Thanks for testing ;)

avatar TobsBobs
TobsBobs - comment - 26 Jan 2013

Hello,

after I enabled cURL, it works very well. Great work! ;)

greeting
Tobi

avatar mbabker
mbabker - comment - 1 Feb 2013

Does that have to be hardcoded to use curl or can we use JHttp to get whatever it was that caused the error? Or is this just the first cut and bugs are expected?

avatar elkuku
elkuku - comment - 1 Feb 2013

The hard coded curl is used to make a silly redirect which is made when requesting the default GitHub avatar. Maybe it also works with JHttp aka url_fopen, and I did not found the right parameters.

The PR is more about authentication - avatars are nice but not vital...

But yes, bugs are always expected :P

avatar dongilbert
dongilbert - comment - 29 Apr 2013

This could be closed now that we're using the Framework GitHub package, right?

avatar mbabker
mbabker - comment - 29 Apr 2013

Well, the actual code needs to be refactored a bit now that we're using the Framework code (and some of the stuff doesn't exist now), but the issue itself is still valid.

avatar elkuku
elkuku - comment - 29 Apr 2013

I would even raise the priority (if possible) as I think the "user/auth/acl" part should be cleared rather sooner than later so we can move on..

The question is (still) if we really need a separate user management or if we can live with the fact that every person contributing to the tracker must have an account on GitHub.

This PR does just this and also supports the first "submitting" action allowing to submit comment on issues to GitHub.

Should I refactor ?

avatar mbabker
mbabker - comment - 29 Apr 2013

In terms of user management, at the most, we'll need some sort of basic ACL for some of the code. Otherwise, we don't need anything complicated. One of the ideas for later on is to have user profiles, so we'll need something linking the user accounts between the app and GitHub.

We've pretty much gotten the OK from all but the "I want nothing to do with GitHub" crowd in JBS that requiring a GitHub account is a good way to go, so we're past that battle.

avatar elkuku
elkuku - comment - 9 May 2013

#103

avatar elkuku elkuku - close - 9 May 2013
avatar - close - 9 May 2013

Add a Comment

Login with GitHub to post a comment