Coder Social home page Coder Social logo

gaeauth0callback's Introduction

Google App Engine Auth0 Callback

Background

Our Google App Engine (GAE) site made in Java needed a authorization with social media and with registration. Auth0 solved all problems but the Java sample project couldn't be fully used by GAE since it used Resty which produced to following exception message:

No CookieHandler. Running on GAE? Fine. No cookie support for you!

Caused by

java.security.AccessControlException: access denied ("java.net.NetPermission" "setDefaultAuthenticator")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:375)

Setup

Follow the guidelines at Auth0.com

https://auth0.com/docs/quickstart/webapp/java

Suggested implementation of (above) webapp to GAE

  1. Add to maven
    <dependency>
        <groupId>com.auth0</groupId>
        <artifactId>auth0-servlet</artifactId>
        <version>2.0</version>
    </dependency>
  1. Add GAEAuth0Callback files to your source

  2. Instead of using Auth0Callback, use this setup in web.xml

    <!-- Auth0 servlets -->
    <servlet>
        <servlet-name>RedirectCallback</servlet-name>
        <servlet-class>com.auth0.gae.GAEAuth0Callback</servlet-class>
    <init-param>
        <param-name>auth0.redirect_on_success</param-name>
        <param-value>/auth0/</param-value>
    </init-param>
    <init-param>
        <param-name>auth0.redirect_on_error</param-name>
        <param-value>/signin/</param-value>
    </init-param>
    <init-param>
        <param-name>gae.auth0.token_attribute_key</param-name>
        <param-value>auth0tokens</param-value>
    </init-param>
    <init-param>
        <param-name>gae.auth0.user_attribute_key</param-name>
        <param-value>user</param-value>
    </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>RedirectCallback</servlet-name>
        <url-pattern>/auth0-callback/</url-pattern>
    </servlet-mapping>

gaeauth0callback's People

Stargazers

Carl Emmoth avatar Kunal Dabir avatar

Watchers

James Cloos 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.