GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - aserto-dev/aserto-java: Java library for Aserto services

BranchesTags
Open more actions menu

Latest commit

 

History

63 Commits
63 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
examples
examples
 
 
src
src
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

Aserto Java

slack

Java library for Aserto services

Warning

0.31.1 is the latest version published to maven central. Versions starting with 1.0.z have been removed from maven central and are no longer available for download.

Build

mvn clean install

Add the client to your project

  • add the fallowing dependency to your pom.xml file
<dependency>
    <groupId>com.aserto</groupId>
    <artifactId>aserto-java</artifactId>
</dependency>

Run unit tests

mvn clean test

Run integration tests

In order to run integration tests we need to have topaz installed

go install github.com/topaz/cmd/topaz@latest
topaz install

The integration tests start topaz and configure it for testing. The tests will fail if topaz is not installed. If you have topaz configured, no worries, the tests will save the configuration and restore it after the integration tests are finished. To run the integration tests use the fallowing command:

mvn test -Pintegration

Release the project on maven central

mvn clean deploy -Dgpg.passphrase="<gpg-passphrase>" -Pci-cd

Authorization Example

Start topaz

// create a channel that has the connection details
ManagedChannel channel = new ChannelBuilder()
        .withHost("localhost")
        .withPort(8282)
        .withInsecure(true)
        .build();

// create authz client
AuthorizerClient authzClient = new AuthzClient(channel);

// identity context contains information abou the user that requests access to some resource
IdentityCtx identityCtx = new IdentityCtx("[email protected]", IdentityType.IDENTITY_TYPE_SUB);

// contains information about the policy we want to check for the provided identity
PolicyCtx policyCtx = new PolicyCtx("todo", "todo", "todoApp.DELETE.todos.__id", new String[]{"allowed"});

// check if the identity is allowed to perform the action
List<Decision> decisions = authzClient.is(identityCtx, policyCtx);
authzClient.close();

decisions.forEach(decision -> {
    String dec = decision.getDecision();
    boolean isAllowed =  decision.getIs();
    System.out.println("For decision [" + dec + "] the answer was [" + isAllowed + "]");
});

For more examples have a look in the examples folder.

About

Java library for Aserto services

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

5 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.