Simple webapp that lets you upload and download files.
- java
- Clojure CLI
- docker
The webapp uses Open ID Connect for authentication and authorization. The example bellow sets up a Keycloak server, but any OIDC server should work (though you might need to change the no.neksa.upload/authorized?
function).
- Start a Keycloak container
docker run -d --name keycloak -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin quay.io/keycloak/keycloak:14.0.0
- Go to http://localhost:8080 and login using username admin and password admin
- Create a new client named upload
Clients > Create
- Once created change the Access Type to Confidential
- Add http://localhost:3030/* as a Valid Redirect URI
- Press Save
- Go to the Credentials-tab and copy the client secret
- Create a file named
secret.edn
in the project root folder with the following contents
{:client-secret "<paste secret here>"}
- Create a new role called upload
Roles > Add Role
- Add the upload role to a user, for example the admin user
Users > ~select a user~ > Role Mappings
- Log out of the Keycloak admin console
- Start the Keycloak if it is not already started
docker start keycloak
- Change directory to the project root folder
- Start the repl
clj
- Enter the following into the REPL to start the app
(require 'no.neksa.upload.core)
(no.neksa.upload.core/-main)
- Start the Keycloak if it is not already started
docker start keycloak
- Change directory to the project root folder
- Build the uberjar
clj -M:uberdeps
- Run the jar
java -cp target/upload-clj.jar clojure.main -m no.neksa.upload.core