-
Notifications
You must be signed in to change notification settings - Fork 1
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
Victor Shneer
committed
Feb 16, 2023
0 parents
commit faf5adb
Showing
10 changed files
with
155 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,45 @@ | ||
# Gradle | ||
.gradle/ | ||
build/ | ||
|
||
# Eclipse | ||
.project | ||
.classpath | ||
.settings/ | ||
bin/ | ||
|
||
|
||
# IntelliJ | ||
.idea/ | ||
.idea | ||
*.ipr | ||
*.iml | ||
*.iws | ||
|
||
# NetBeans | ||
nb-configuration.xml | ||
|
||
# Visual Studio Code | ||
.vscode | ||
.factorypath | ||
|
||
# OSX | ||
.DS_Store | ||
|
||
# Vim | ||
*.swp | ||
*.swo | ||
|
||
# patch | ||
*.orig | ||
*.rej | ||
|
||
# Local environment | ||
.env | ||
env.sh | ||
|
||
*.daml/ | ||
|
||
*.log | ||
log/ | ||
|
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,21 @@ | ||
# DAML WITH AUTH | ||
|
||
The goal of this repo is to provide an example of a simple daml app with Auth0 protection | ||
AuthT and AuthZ for Navigator, JSON API client and UI | ||
|
||
## Launch tips | ||
``` | ||
daml sandbox --config auth.conf | ||
``` | ||
``` | ||
daml ledger upload-dar --host localhost --port 6865 --access-token-file m2m-access.token .daml/dist/daml-with-auth-0.0.1.dar | ||
``` | ||
``` | ||
daml script --dar .daml/dist/daml-with-auth-0.0.1.dar --script-name Test:allocateParties --access-token-file m2m-access.token --ledger-host localhost --ledger-port 6865 | ||
``` | ||
``` | ||
daml ledger list-parties --host localhost --port 6865 --access-token-file m2m-access.token | ||
``` | ||
``` | ||
token : {"admin": true, "actAs": ["Alice::1220dcfdf8c383f01ecc8a1d0147ec5ef58cfa1939736da62bbecc774e836b50a8bc", "Bob::1220dcfdf8c383f01ecc8a1d0147ec5ef58cfa1939736da62bbecc774e836b50a8bc"]} | ||
``` |
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,5 @@ | ||
canton.participants.sandbox.ledger-api.auth-services = [{ | ||
type = jwt-rs-256-jwks | ||
url = "https://dev-rphl6e3zqdlcram3.us.auth0.com/.well-known/jwks.json" | ||
}] | ||
|
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,8 @@ | ||
sdk-version: 2.5.0 | ||
name: daml-with-auth | ||
source: daml | ||
version: 0.0.1 | ||
dependencies: | ||
- daml-prim | ||
- daml-stdlib | ||
- daml-script |
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,23 @@ | ||
module Main where | ||
|
||
template Agreement | ||
with | ||
proposer: Party | ||
counterparty: Party | ||
payload: Text | ||
where | ||
signatory proposer, counterparty | ||
|
||
template Proposal | ||
with | ||
proposer: Party | ||
counterparty: Party | ||
payload: Text | ||
where | ||
signatory proposer | ||
observer counterparty | ||
|
||
choice Accept : ContractId Agreement | ||
controller counterparty | ||
do | ||
create Agreement with .. |
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,21 @@ | ||
module Test where | ||
|
||
import Daml.Script | ||
|
||
import Main (Proposal(..), Accept(..)) | ||
|
||
allocateParties : Script((Party, Party)) | ||
allocateParties = script do | ||
proposer <- allocatePartyWithHint "proposer" (PartyIdHint "proposer") | ||
counterparty <- allocatePartyWithHint "counterparty" (PartyIdHint "counterparty") | ||
|
||
return (proposer, counterparty) | ||
|
||
testIt : Script () | ||
testIt = script do | ||
(proposer, counterparty) <- allocateParties | ||
let payload = "rent agreement" | ||
proposalCid <- submit proposer do createCmd Proposal with .. | ||
agrCid <- submit counterparty do exerciseCmd proposalCid Accept | ||
|
||
pure () |
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,28 @@ | ||
# The following options relate to Auth0 setup and service credentials. Please see documentation for meaning | ||
# Use in auth-config.json in UI | ||
AUTH0_DOMAIN="-" | ||
AUTH0_CLIENT_ID="-" | ||
|
||
# Auth0 Service Account credentials | ||
|
||
M2M_CLIENT_ID='-' | ||
M2M_CLIENT_SECRET='-' | ||
|
||
NAVIGATOR_CLIENT_ID='-' | ||
NAVIGATOR_CLIENT_SECRET='-' | ||
|
||
TRIGGER_CLIENT_ID='-' | ||
TRIGGER_CLIENT_SECRET='-' | ||
|
||
# Minimal token for JSON API - public rights only to retrieve DAML Packages | ||
JSON_CLIENT_ID='-' | ||
JSON_CLIENT_SECRET='-' | ||
|
||
ALICE_CLIENT_ID='-' | ||
ALICE_CLIENT_SECRET='-' | ||
|
||
BOB_CLIENT_ID='-' | ||
BOB_CLIENT_SECRET='-' | ||
|
||
LEDGER_ID="sandbox" | ||
|
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 @@ | ||
curl -v --request POST \ | ||
--url https://dev-rphl6e3zqdlcram3.us.auth0.com/oauth/token \ | ||
--header 'content-type: application/json' \ | ||
--data "{ \"client_id\": \"\", \"client_secret\": \"\", \"audience\": \"https://daml.com/ledger-api\", \"grant_type\": \"client_credentials\" }" |
Empty file.
Empty file.