Skip to content

Commit 4a520d1

Browse files
docs(jans-cedarling): update the Java binding documentation to align it with multi-issuer authorization (#13820)
* docs: update the Java binding documentation to align it with multi-issuer authorization Signed-off-by: duttarnab <arnab.bdutta@gmail.com> * feat: docs correction Signed-off-by: duttarnab <arnab.bdutta@gmail.com> * feat: remove not required fields from bootstrap config Signed-off-by: duttarnab <arnab.bdutta@gmail.com> * feat: update the Java binding documentation to align it with multi-issuer authorization Signed-off-by: duttarnab <arnab.bdutta@gmail.com> * feat: address code-rabbit comments Signed-off-by: duttarnab <arnab.bdutta@gmail.com> * feat: address code-rabbit comments Signed-off-by: duttarnab <arnab.bdutta@gmail.com> * feat: address review comments Signed-off-by: duttarnab <arnab.bdutta@gmail.com> * feat: address review comments Signed-off-by: duttarnab <arnab.bdutta@gmail.com> --------- Signed-off-by: duttarnab <arnab.bdutta@gmail.com> Signed-off-by: Arnab Dutta <arnab.bdutta@gmail.com> Co-authored-by: Devrim <devrimyatar@gluu.org>
1 parent 3a7db52 commit 4a520d1

5 files changed

Lines changed: 243 additions & 181 deletions

File tree

docs/cedarling/developer/cedarling-kotlin.md

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,15 @@ can also build it from source.
4646

4747
## Recipes
4848

49-
### Use the Cedarling Java binding in custom scripts
49+
### Using the Cedarling Java binding in custom scripts on the Janssen Auth Server (VM installation).
5050

51-
Here is a simple recipe to add scopes in access-token using update_token script only if the requesting client has `authorization_code` grant-type. We will use below policy for this:
51+
Here is a simple recipe to add scopes to the access token using the update_token script only when the requesting client uses the authorization_code grant type. We will use [Agama Lab's](https://cloud.gluu.org/agama-lab) Policy Designer to create a simple Policy Store with the following policies and schema.
5252

53-
```bash
54-
@id("Allow if the grant type is authorization_code")
53+
##### Policies
54+
55+
```declarative
56+
57+
@id("Allow_authorization_code")
5558
permit (
5659
principal is Jans::Workload,
5760
action == Jans::Action::"Execute",
@@ -60,11 +63,69 @@ permit (
6063
when {
6164
principal.grantTypes.contains("authorization_code")
6265
};
66+
67+
```
68+
69+
##### Schema
70+
71+
```declarative
72+
73+
namespace Jans {
74+
type Context = {
75+
current_time?: Long,
76+
device_health?: Set<String>,
77+
fraud_indicators?: Set<String>,
78+
geolocation?: Set<String>,
79+
network?: String,
80+
network_type?: String,
81+
operating_system?: String,
82+
user_agent?: String
83+
};
84+
85+
type Url = String;
86+
87+
type email_address = {
88+
domain: String,
89+
uid: String
90+
};
91+
92+
entity Application = {
93+
grantTypes: Set<String>
94+
};
95+
96+
entity Role;
97+
98+
entity TrustedIssuer = {
99+
issuer_entity_id: Url
100+
};
101+
102+
entity User in [Role] = {
103+
email?: email_address,
104+
role: Set<String>,
105+
sub?: String
106+
};
107+
108+
entity Workload = {
109+
client_id: String,
110+
grantTypes: Set<String>,
111+
iss?: TrustedIssuer,
112+
name?: String,
113+
rp_id?: String,
114+
spiffe_id?: String
115+
};
116+
117+
action "Execute" appliesTo {
118+
principal: [Workload],
119+
resource: [Application],
120+
context: Context
121+
};
122+
}
123+
63124
```
64125

65126
**Steps:**
66127

67-
- Upload [bootstrap.json](../uniffi/cedarling-sample-inputs.md/#bootstrapjson) and [policy-store.json](../uniffi/cedarling-sample-inputs.md/#policy-storejson) at `/opt/jans/jetty/jans-auth/custom/static` location of the auth server. The [Asset Screen](https://docs.jans.io/v1.6.0/janssen-server/config-guide/custom-assets-configuration/#asset-screen) can be used to upload assets.
128+
- Upload [bootstrap.json](../uniffi/cedarling-sample-inputs.md/#bootstrapjson) and policy-store file (with .cjar extension released from the Agama Lab) at `/opt/jans/jetty/jans-auth/custom/static` location of the auth server. The [Asset Screen](https://docs.jans.io/v1.6.0/janssen-server/config-guide/custom-assets-configuration/#asset-screen) can be used to upload assets.
68129
- Upload the generate `cedarling-java-{version}.jar` at `/opt/jans/jetty/jans-auth/custom/libs` location of the auth server.
69130

70131
!!! note

docs/cedarling/developer/mobile-apps/cedarling-android.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,19 @@ Cedarling UniFFI binding exposes its `init`, `authz` and `log` interfaces to dif
1111
## Building
1212

1313
1. Ask toolchain manager to install support for compiling Rust code for aarch64-linux, armv7-linux, i686-linux and x86_64-linux.
14-
15-
```bash
16-
rustup target add \
17-
aarch64-linux-android \
18-
armv7-linux-androideabi \
19-
i686-linux-android \
20-
x86_64-linux-android
21-
```
14+
```bash
15+
rustup target add \
16+
aarch64-linux-android \
17+
armv7-linux-androideabi \
18+
i686-linux-android \
19+
x86_64-linux-android
20+
```
2221

2322
2. Run below command to build and import binding into Android project.
2423
```bash
2524
make android
2625
```
27-
28-
Use `make android BUILD_TYPE=release` or `make android BUILD_TYPE=debug` to build in `release` or `debug` mode. If `BUILD_TYPE` is not specified, the `release` profile is used by default.
26+
Use `make android BUILD_TYPE=release` or `make android BUILD_TYPE=debug` to build in `release` or `debug` mode. If `BUILD_TYPE` is not specified, the `release` profile is used by default.
2927

3028
3. We have included a sample android app using Cedarling UniFFI binding for making authorisation decisions. Open the `./bindings/cedarling_uniffi/androidApp` project on Android Studio and run the project on simulator.
3129

docs/cedarling/developer/mobile-apps/cedarling-ios.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,15 @@ Cedarling UniFFI binding exposes its `init`, `authz` and `log` interfaces to dif
1616
```
1717

1818
2. Ask toolchain manager to install support for compiling Rust code for iOS devices and iOS Simulator
19-
2019
```bash
2120
rustup target add aarch64-apple-darwin aarch64-apple-ios-sim aarch64-apple-ios
2221
```
2322

2423
3. Run below command to build and import binding into iOS project:
25-
2624
```bash
2725
make ios
2826
```
29-
30-
Use `make ios BUILD_TYPE=release` or `make ios BUILD_TYPE=debug` to build in `release` or `debug` mode. If `BUILD_TYPE` is not specified, the `release` profile is used by default.
27+
Use `make ios BUILD_TYPE=release` or `make ios BUILD_TYPE=debug` to build in `release` or `debug` mode. If `BUILD_TYPE` is not specified, the `release` profile is used by default.
3128

3229
4. Open `./bindings/cedarling_uniffi/iOSApp` in Xcode. Import both the XCFramework `./bindings/ios/Mobile.xcframework` and the Swift file bindings `./bindings/build/cedarling_uniffi.swift` files into your project (drag and drop should work).
3330

0 commit comments

Comments
 (0)