Skip to content

Commit

Permalink
Use aserto-java 0.21.0 in examples. (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanIrimie authored Jan 3, 2024
1 parent 29a8c04 commit 9216989
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/authz-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dependency>
<groupId>com.aserto</groupId>
<artifactId>aserto-java</artifactId>
<version>0.20.10</version>
<version>0.21.00</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.example;

import com.aserto.AuthorizerClient;
import com.aserto.AuthzClient;
import com.aserto.ChannelBuilder;
import com.aserto.authorizer.AuthzClient;
import com.aserto.authorizer.v2.Decision;
import com.aserto.authorizer.v2.api.IdentityType;
import com.aserto.model.IdentityCtx;
Expand Down
2 changes: 1 addition & 1 deletion examples/directory-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dependency>
<groupId>com.aserto</groupId>
<artifactId>aserto-java</artifactId>
<version>0.20.10</version>
<version>0.21.00</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package org.example;

import com.aserto.ChannelBuilder;
import com.aserto.directory.v3.DirectoryClient;
import com.aserto.directory.common.v3.ObjectIdentifier;
import com.aserto.directory.reader.v3.GetObjectManyResponse;
import com.aserto.directory.reader.v3.GetObjectResponse;
import com.aserto.directory.reader.v3.GetObjectsResponse;
import com.aserto.directory.v3.DirectoryClient;

import com.aserto.directory.v3.Directory;
import com.aserto.directory.v3.UninitilizedClientException;
import io.grpc.ManagedChannel;

import javax.net.ssl.SSLException;
import java.util.List;

public class DirectoryExample {
public static void main(String[] args) throws SSLException {
public static void main(String[] args) throws SSLException, UninitilizedClientException {
// create a channel that has the connection details
ManagedChannel channel = new ChannelBuilder()
.withHost("localhost")
Expand All @@ -29,19 +31,19 @@ public static void main(String[] args) throws SSLException {
getObjectManyRequest(directoryClient);
}

public static void getUserExample(DirectoryClient directoryClient) {
public static void getUserExample(DirectoryClient directoryClient) throws UninitilizedClientException {
System.out.println("------ Get user example ------");
GetObjectResponse getObjectResponse = directoryClient.getObject("user", "morty@the-citadel.com", false);
System.out.println(getObjectResponse);
}

public static void getUsersExample(DirectoryClient directoryClient) {
public static void getUsersExample(DirectoryClient directoryClient) throws UninitilizedClientException {
System.out.println("------ Get users example ------");
GetObjectsResponse getObjectsResponse = directoryClient.getObjects("user", 100, "");
System.out.println(getObjectsResponse);
}

public static void getObjectManyRequest(DirectoryClient directoryClient) {
public static void getObjectManyRequest(DirectoryClient directoryClient) throws UninitilizedClientException {
System.out.println("------ Get object many example ------");
List<ObjectIdentifier> objects = List.of(
Directory.buildObjectIdentifier("user", "rick@the-citadel.com"),
Expand Down

0 comments on commit 9216989

Please sign in to comment.