-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
gradle | ||
.gradle | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Zero Access | ||
=== | ||
|
||
Library to check user roles in AnyLogic models. | ||
|
||
High-level flow: | ||
|
||
- User is logged in via OIDC | ||
- AnyLogic model is started from a web page | ||
- OIDC ID token is set as a model input parameter | ||
- Zero Access library is used to check the user role in order to display or hide GUI elements | ||
|
||
## Usage in AnyLogic | ||
|
||
Download jarfile from https://github.com/Zenmo/zero-access/releases and add to dependencies. | ||
|
||
Then use the `hasRole` function to check if the user has a specific role. | ||
|
||
```jshelllanguage | ||
import static com.zenmo.zeroaccess.ZeroAccessKt.hasRole; | ||
if (hasRole("admin", idToken)) { | ||
// show GUI element | ||
} | ||
``` | ||
|
||
## Obtain an ID token | ||
|
||
How to easily obtain an ID token to run a model locally? | ||
|
||
If you have an account at Zenmo: https://zenmo.com/my-tokens/ | ||
|
||
## Building | ||
|
||
``` | ||
./gradlew shadowJar | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import org.jetbrains.kotlin.config.JvmTarget | ||
|
||
plugins { | ||
id("com.github.johnrengelman.shadow") version "8.1.1" | ||
kotlin("jvm") version "1.9.23" | ||
} | ||
|
||
group = "com.zenmo" | ||
version = "0.1" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
testImplementation(kotlin("test")) | ||
|
||
implementation("com.nimbusds:nimbus-jose-jwt:9.39.2") | ||
implementation("com.google.crypto.tink:tink:1.13.0") | ||
|
||
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.9.23") | ||
} | ||
|
||
tasks.test { | ||
// useJUnitPlatform() | ||
} | ||
kotlin { | ||
jvmToolchain(17) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kotlin.code.style=official |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Fri May 31 12:21:40 CEST 2024 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |