A really insecure oauth2 provider implementation.
Provides the following endpoints:
Redirect your user to
/o/authorize/?response_type=code&client_id=whatever&redirect_uri=http%3A%2F%2Flocalhost%3A9001%2Flogin%2Fcallback%2F&state=1234
and fakesso
will redirect them to the redirect_uri
you provided with the
same state
you provided and an additional query-param called code
.
Http POST to /o/token/
with the code you were given (or any code, it doesn't
care).
If you want it to return any custom scopes then just add scope=whatever
to your POST body.
It'll return you an access token in the form:
{
"access_token": "RFHEYFGWTPGNRCAAMYAD",
"expires_in": 57861,
"scope": "read write",
"token_type": "Bearer"
}
If you're using an app that is validating oauth2 access tokens using RFC 7662,
then point that app to use the provided introspect endpoint.
It will respond saying that any access_token
is active and expires in the
future.
If you want it to return any custom scopes then just add scope=whatever
to your POST body.
{
"active": true,
"exp": 96348,
"scope": "read write"
}
- Download a release: releases
- make sure you have java 8
- decide what port you want it running on and export the PORT environment variable:
export PORT=12345
- Run
java -jar fakesso-0.0.3-standalone.jar
- Start the application:
lein run
- Go to localhost:8080.
- Read your app's source code at src/fakesso/service.clj. Explore the docs of functions that define routes and responses.
- Run your app's tests with
lein test
. Read the tests at test/fakesso/service_test.clj. - Learn more! See the Links section below.
To configure logging see config/logback.xml. By default, the app logs to stdout. To learn more about configuring Logback, read its documentation.
- Start a new REPL:
lein repl
- Start your service in dev-mode:
(def dev-serv (run-dev))
- Connect your editor to the running REPL session. Re-evaluated code will be seen immediately in the service.
Docker container support
- Build an uberjar of your service:
lein uberjar
- Build a Docker image:
sudo docker build -t fakesso .
- Run your Docker image:
docker run -p 8080:8080 fakesso
- Build and run your image:
capstan run -f "8080:8080"
Once the image it built, it's cached. To delete the image and build a new one:
capstan rmi fakesso; capstan build