Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

udacity/github-oauth-servlet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Circle CI Coverage Status

github-oauth-servlet is a drop-in Servlet that adds GitHub organization-based authentication to your J2EE project.

Usage

Set the following configuration, either as envrionment variables or as Java system properties:

  • GH_CLIENT_ID: The client ID you received from GitHub when you registered
  • GH_CLIENT_SECRET: The client secret you received from GitHub when you registered.
  • GH_OAUTH_URL: For production, use https://github.com/login/oauth. For development and testing, consider using a local mock server instead.
  • GH_API_URL: For production, use https://api.github.com. For development and testing, consider using a local mock server instead.
  • GH_ORG: The GitHub organization that users must be a member of to authenticate.

Drop the Servlet into your web.xml:

<servlet>
  <servlet-name>github oauth servlet</servlet-name>
  <servlet-class>com.udacity.github.oauth.GitHubOauthServlet</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>github oauth servlet</servlet-name>
  <url-pattern>/oauth/github/*</url-pattern>
</servlet-mapping>

To authenticate a user, redirect them to /oauth/github[/$continue], where $continue is a URI-encoded URL to redirect to after successful authentication.

Upon successful authentication, the auth-key cookie will be set, with which the user can be looked up via GitHubOauthServlet#get.

References

Archival Note

This repository is deprecated; therefore, we are going to archive it. However, learners will be able to fork it to their personal Github account but cannot submit PRs to this repository. If you have any issues or suggestions to make, feel free to:

About

A simple Servlet for authenticating GitHub organization users

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages