Git Product home page Git Product logo

scribe-up's Introduction

What is scribe-up ?

scribe-up ("up" for User Profile) is a web OAuth client to :

  1. delegate authentication and permissions to an OAuth provider (i.e. the user is redirected to the OAuth provider to log in)
  2. (in the application) retrieve the profile of the authorized user after successfull authentication and permissions acceptation (at the OAuth provider).

It's available under the Apache 2 license and based on : scribe-java (for OAuth protocol) and Jackson (for JSON parsing).

OAuth providers supported

Web siteProtocolProviderProfile
sites using OAuth Wrapper for CAS serverOAuth 2.0CasOAuthWrapperProviderCasOAuthWrapperProfile
DropBoxOAuth 1.0DropBoxProviderDropBoxProfile
FacebookOAuth 2.0FacebookProviderFacebookProfile
GithubOAuth 2.0GitHubProviderGitHubProfile
GoogleOAuth 1.0 & 2.0GoogleProvider & Google2ProviderGoogleProfile & Google2Profile
LinkedInOAuth 1.0LinkedInProviderLinkedInProfile
TwitterOAuth 1.0TwitterProviderTwitterProfile
Windows LiveOAuth 2.0WindowsLiveProviderWindowsLiveProfile
WordPressOAuth 2.0WordPressProviderWordPressProfile
YahooOAuth 1.0YahooProviderYahooProfile

Follow the guide to extend or add a new provider.

Code sample

Suppose you want to authenticate and get the user profile from Facebook :

// declare the provider (use default scope and fields)
FacebookProvider provider = new FacebookProvider();
provider.setKey(MY_KEY);
provider.setSecret(MY_SECRET);
provider.setCallbackUrl("http://myserver/myapp/callbackUrl");
// send the user to Facebook for authentication and permissions
response.sendRedirect(provider.getAuthorizationUrl(new HttpUserSession(session)));

...after successfull authentication, on the callback url for Facebook...

// get OAuth credentials
OAuthCredential credential = provider.getCredential(new HttpUserSession(request), request.getParameterMap());
// get the user profile
UserProfile userProfile = provider.getUserProfile(credential);
// get the facebook profile
FacebookProfile facebookProfile = (FacebookProfile) userProfile;
System.out.println("Hello : " + facebookProfile.getDisplayName() + " born the " + facebookProfile.getBirthday());

If the user can be authenticated by several OAuth providers, use the common profile instead :

CommonProfile commonProfile = (CommonProfile) userProfile;
System.out.println("Hello : " + commonProfile.getDisplayName() + " at " + commonProfile.getEmail());

If you want to interact more with the OAuth provider, you can retrieve the access token from the (OAuth) profile :

OAuthProfile oauthProfile = (OAuthProfile) userProfile;
String accessToken = oauthProfile.getAccessToken();
// or
String accesstoken = facebookProfile.getAccessToken();

For a better understanding of scribe-up, take a look at the technical description of the project or browse the Javadoc.

Libraries built on scribe-up

Even if you can use scribe-up on its own, this library is used to be the foundation of :

  1. the cas-server-support-oauth module to add OAuth client and server support to the CAS server
  2. the buji-oauth library to add OAuth client support to the Apache Shiro project
  3. the spring-security-oauth-client library to add OAuth client support to Spring Security.
  4. the play-oauth-client library to add OAuth client support to the Play 2.0 framework.
LibraryBased on scribe-up versionDemo webapp
cas-server-support-oauth 3.5.21.2.0cas-oauth-demo-3.5.x
cas-server-support-oauth 3.5.11.1.0cas-oauth-demo-3.5.x
cas-server-support-oauth 3.5.01.0.0cas-oauth-demo-3.5.0
buji-oauth 1.1.01.3.1buji-oauth-demo
buji-oauth 1.0.01.2.0buji-oauth-demo-1.0.0
spring-security-oauth-client 1.1.01.3.1spring-security-oauth-client-demo
spring-security-oauth-client 1.0.01.2.0spring-security-oauth-client-demo-1.0.0
play-oauth-client 1.0.01.3.1play-oauth-client-java-demo
play-oauth-client-scala-demo

Versions

The last released version is the 1.3.1. Learn more about the different versions.

The current version : 1.3.2-SNAPSHOT is under development, it's available on Sonatype snapshots repository as Maven dependency :

<dependency>
    <groupId>org.scribe</groupId>
    <artifactId>scribe-up</artifactId>
    <version>1.3.2-SNAPSHOT</version>
</dependency>

Testing

scribe-up is tested by more than 200 unit, bench and integration tests on OAuth providers (which simulate complete authentication processes using the HtmlUnit library).

Contact

Find me on LinkedIn or by email : [email protected]

scribe-up's People

Contributors

leleuj avatar mehdiabbes avatar peterknego avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.