-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0fa42c9
Showing
7 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# clojure-app | ||
|
||
FIXME | ||
|
||
## Prerequisites | ||
|
||
You will need [Leiningen][1] 1.7.0 or above installed. | ||
|
||
[1]: https://github.com/technomancy/leiningen | ||
|
||
## Running | ||
|
||
To start a web server for the application, run: | ||
|
||
lein ring server | ||
|
||
## License | ||
|
||
Copyright © 2012 FIXME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(defproject clojure-app "0.1.0-SNAPSHOT" | ||
:description "FIXME: write description" | ||
:url "http://example.com/FIXME" | ||
:dependencies [[org.clojure/clojure "1.4.0"] | ||
[compojure "1.1.1"] | ||
[tk.skuro/clj-oauth2 "0.5.1"] | ||
[ring/ring-jetty-adapter "1.1.0"]] | ||
:plugins [[lein-ring "0.7.3"]] | ||
:ring {:handler devcon.handler/app} | ||
:profiles | ||
{:dev {:dependencies [[ring-mock "0.1.3"]]}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#Basic configuration properties | ||
#Use the values from your account on the Alfresco Developer Portal (developer.alfresco.com) | ||
# | ||
#Set client_id to the value of "Api Key" (on the "Auth" tab when you edit an application in the portal) | ||
#Set client_secret to the value of "Key Secret" (on the "Auth" tab when you edit an application in the portal) | ||
#For this application, the redirect_uri should be set to "http://localhost:8090/alfapi/dance/callback" | ||
#(The redirect_uri MUST match the value you set as the "Callback URL" on the "Auth" tab in the portal) | ||
|
||
client-id="l7xx3f7c3c67d974472bb03850aaf6523eeb" | ||
client-secret="d1e308dfc0ac4c7398c443436ea307be" | ||
#redirect-uri=http://localhost:8090/alfapi/dance/callback | ||
authorization-uri="https://api.alfresco.com/auth/oauth/versions/2/authorize?" | ||
redirect-uri="http://localhost:3000/callback" | ||
access-token-uri="https://api.alfresco.com/auth/oauth/versions/2/token" | ||
#authURL=https://api.alfresco.com/auth/oauth/versions/2/authorize | ||
#tokenURL=https://api.alfresco.com/auth/oauth/versions/2/token | ||
#scope=public_api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
(ns devcon | ||
(:require [clojure.java.io :as io] | ||
[clj-oauth2.ring :as oauth2-ring])) | ||
|
||
(def file-name "config.properties") | ||
|
||
(defn load-config | ||
[] | ||
(with-open [^java.io.Reader reader (-> file-name io/resource io/reader)] | ||
(let [props (java.util.Properties.)] | ||
(.load props reader) | ||
(into {:scope ["public_api"] | ||
:grant-type "authorization_code" | ||
:get-state oauth2-ring/get-state-from-session | ||
:put-state oauth2-ring/put-state-in-session | ||
:get-target oauth2-ring/get-target-from-session | ||
:put-target oauth2-ring/put-target-in-session | ||
:get-oauth2-data oauth2-ring/get-oauth2-data-from-session | ||
:put-oauth2-data oauth2-ring/put-oauth2-data-in-session} | ||
(for [[k v] props] [(keyword k) (read-string v)]))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
(ns devcon.handler | ||
(:use compojure.core) | ||
(:require [devcon] | ||
[devcon.start :as start] | ||
[compojure.handler :as handler] | ||
[clj-oauth2.ring :as o2-ring] | ||
[clj-oauth2.client :as o2])) | ||
|
||
(defroutes app-routes | ||
(GET "/" [] start/start)) | ||
|
||
(def config (devcon/load-config)) | ||
|
||
(def app | ||
(-> app-routes | ||
(o2-ring/wrap-oauth2 config) | ||
handler/site)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(ns devcon.jetty | ||
(:require [compojure.route :as route] | ||
[ring.adapter.jetty :as jetty])) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(ns devcon.start | ||
(:use compojure.core) | ||
(:require [compojure.handler :as handler] | ||
[compojure.route :as route])) | ||
|
||
(defn start [_] | ||
"Hello, world!") |