Adding GerritForge for 2.9-SNAPSHOT and Google for releases

Change-Id: I6a95d4c23f2c75e96f828ae5bb07cdf8f278815a
BugFix: removed duplicate servlet-api Maven dependency

Change-Id: I8e2ed48b5cf1c1b018bcc3e84ecb4527756954da
Remove 1.6 JVM compliance: getting the 1.7 from top pom.xml

The top-level pom.xml already defines Java 1.7 as the source
and binary compliance level: this change aligns the plugin to the top
level setting.

Change-Id: I819c830f7eb5d9fc509183ea961cb192e6627786
Avoid use of @SessionScoped for GitHub login

Guice's session scoped beans rely on the fact
that the the GuiceServlet has been captured the
request and managed in the current thread.
This assumption is not true when a request gets
filtered outside GuiceServlet, as it happens for
the GitHub OAuth Filter.

With this change the GitHub login is directly
obtained from the HTTP Servlet Request without
relying on GuiceServlet on the active request
thread.

Change-Id: Id9d687e9cb0cbab413e71ab5c369e64a10ec74f6
Share GitHub login on Gerrit filter and plugin.

Allows to sign-in to GitHub only once during
Gerrit login and then share the GitHub OAuth token
within the plugin screens.
Previously the two logins were completely isolated
and the user had to connect twice.

With this change is not possible anymore to have
multiple logins with different scopes: not a regression
but a simplification IMHO, as having multiple sessions
with multiple permissions have lead to confusion
on why GitHub permissions are requested twice.

Change-Id: I8aeb131704ee015d67b56670295c231dd6db1478
Multi-OAuth scopes configuration.

Enable the ability to have more than one scope
configured under gerrit.config and switch between
login scopes using a scope parameter in the Gerrit login.

Example use is:

GitHub's config in gerrit.config:
[github]
        scopes = USER_EMAIL,PUBLIC_REPO
        scopesPrivate = USER_EMAIL,REPO

GitHub OAuth USER_EMAIL+PUBLIC_REPO
by default at Gerrit login.

GitHub OAuth USER_EMAIL+REPO is used when loggin
in to Gerrit with /login?scope=scopesPrivate

NOTE: When logged using a specific scope, the OAuth
token is then reused throughout the Gerrit session
without having to specify the scope parameter anymore.

Change-Id: I0a6573bca6c677dd15b7878e7062bcac6b20529d
Resilience against GerritOAuth and JSESSIONID cookies lost

GitHub plugin uses two main cookies to cache OAuth
information:
- GerritOAuth to enrich HTTP requests with auth headers used by
  Gerrit HTTP authentication
- JSESSIONID to get session objects with GitHub client objects

When GerritOAuth or JSESSIONID expire, a transparent GitHub OAuth
renegotiation is needed to recreate them through a new authentication
challenge. OAuth scope is now stored in the GerritOAuth cookie in order
to re-create the same scope-level previously own.

NOTE: GerritOAuth is typically short lived to avoid
      security leak of the OAuth information. JSESSIONID could be lost
      because of workload balancing or failover.

Change-Id: I874c4ae75f2b238dccb0ec8c164628c28f1b5f01
Import of private organisations, repos and pull requests

Overall refactoring to inject GitHubLogin deep into the repo
and pull request importers and include the GitHub user's credentials
for cloning and fetching GitHub repositories.

Change-Id: I7808b09762f5af51a11d407eb68b2e7c7f5dce1b
Redundant injected GitHubLogin removed

GitHubLogin injected via Guice was unused at
GitImporter level: is injected down the chain and
only when needed.

Change-Id: I681d2b4753e525305e006891ceecd965bc2a562a
ScopedProvider is now more similar to standard Guice's Provider

By hiding the HttpServletRequest inside the HttpSessionProvider,
the ScopedProvider<T> can be now 100% compatible with the standard
Guice's Provider<T> interface.

Moving as well from constructor injection to field injection so
that the concrete implementation do not have to replicate the
constructor injection definition. Code is more compact and extensible.

The ability to get an instance by passing an actual HttpServletRequest
is kept in order to allow the standard servlet filter (outside the Guice
domain) to retrieve the object in the current session, without
having to request a Provider<HttpServletRequest> which would fail.

Change-Id: I20f32fc42ca05e9a4a140b64a1d5693d83ecf125
Allow to define different hierarchy for public vs. private repos

It is possible now to differentiate different project hierarchies
for GitHub public and private repositories.
Define the two different base projects in your [github] section using
the publicBaseProject and privateBaseProject.

If not specified in gerrit.config [github] section, the default base
project hierarchy is All-Projects.

Change-Id: Iaea7ee232dbfb2388ab8b23a84b5f397fd2aa150
Display ALL organisations, including private ones

When authorised by GitHub OAuth scope, allows to select any
type of organisation, including private ones.

Change-Id: Id2970f0f0ac09563cc801056a23ae3099e098762
Display repository private/public label

Label private vs. public repositories in list selection
of those to be imported into Gerrit.

Change-Id: I79baaab30840433bd60253eae025c703b21f7ef1
Set GitHub OAuth scope as persistent cookie

Once the GitHub OAuth scope has been chosen for login,
makes it persistent as Browser Cookie with 50 years
max age.

This allows to "remember" the desired login scope
across multiple logins to Gerrit. Scope can be changed
again specifying another "scope=X" query parameter during
login.

Change-Id: I466781c1d14a92809ac8808bee31148fe0ab47b5
GitHub OAuth authentication with Gerrit Git/HTTP protocol

It is possible now to use the standard GitHub OAuth
token on Git / HTTP with Gerrit Code Review.

The details on how GitHub OAuth Token for Git/HTTP
are described at:
https://help.github.com/articles/git-over-https-using-oauth-token

This allows to completely "shadow" your existing
GitHub repository behind a Gerrit Code Review front-end.
Using OAuth token you can automate the batch builds
over HTTP(/S) without having to manage Gerrit HTTP passwords.

NOTE: this requires the [auth.gitBasicAuth] setting
on your gerrit.config as currently there is no way to
seamlessly integrate SSO with Gerrit on Git/HTTP.
The GitHub plugin "automate" a random HTTP password
generate and use it internally for a transparent
BasicAuth, after having validated the GitHub OAuth Token.

Change-Id: I23552e1b559f50056fdc48248f44696726aa1fef
Fetch GitHub full name and e-mail from the plugin profile screen

Allows a user to select his details from the GitHub profile
displayed at /plugins/github-plugin/static/account.html

It is particularly useful when switching from a public identity
(e.g. when using GitHub plugin for OpenSource projects) to a private
use within a company. You can go to the account.html page 
and select an alternative e-mail address and Gerrit will be 
automatically updated.

Change-Id: Ib4ac50194c65336e64d2ef12e8463eccd42ad8e5
Align GitHub OAuth token expire with GerritAccount

Calculate the GerritOAuth Cookie.maxAge in the same
way that Gerrit Cached WebSessions expire.
This allows to avoid the unpleasant situations where
Gerrit session is active but all RESTFul API calls
are failing because of the missing OAuth cookie.

This was perceived as a "Internal Error" pop-up
on the Gerrit UX when the OAuth token expired.

Change-Id: I0d1f5d3be1f9257ee3b8ee5f0ac1dd809f1727fd
Avoid OAuth with REST and RPC calls and static resources

When Gerrit UX is making REST API calls to the backend
by providing both an GerritAccount cookie and
a X-GERRIT-AUTH HTTP Header, the call can be safely
propagate to Gerrit for validation without having to 
necessarily re-create a new GerritOAuth cookie.

Gerrit UX is unable anyway to complete the GitHub
OAuth handshake, there is no value then in getting
the calls redirected to GitHub as it would just break
the user interface.

Change-Id: Ie1566364be6eb647609971b88e2a30c78e012afe
Avoid using Jenkins CI Maven Repo for snapshot artifacts

Snapshot artifacts are typically provided by the 
GerritForge CI and thus do not have to be searched
in Jenkins maven repo.

Change-Id: I3472e4fb4a0c414ff00cf261e7be36815450e9ac