Getting Started
Follow these steps to get started with Warrant, from account creation to creating and enforcing rules in < 10 minutes.
Create an account
- First, create an account for your organization.
- Once you're logged in, you can view your API keys and invite your teammates.
- The dashboard lets you view and manage your entire authorization model, including your object types, warrants, users, tenants and environments.
note
If a Warrant account already exists for your organization, please ask your account admin to invite you directly from the dashboard.
Install & configure SDK(s)
The primary way to interact with Warrant is via the REST APIs. You can call API endpoints directly (API reference) or use the native and open-source libraries:
Back-end (server-side)
- Go
- Node.js
- Python
- Java
- Ruby
- PHP
Install:
go get github.com/warrant-dev/warrant-go/v3
Usage:
import (
"github.com/warrant-dev/warrant-go/v3"
)
client := warrant.NewClient(config.ClientConfig{
ApiKey: "YOUR_KEY"
})
Install:
npm install @warrantdev/warrant-node
Usage:
import { WarrantClient } from "@warrantdev/warrant-node";
const warrantClient = new WarrantClient({
apiKey: "YOUR_KEY",
});
Install (Gradle):
implementation group: 'dev.warrant', name: 'warrant-java', version: 'x.x.x'
Install (Maven):
<dependency>
<groupId>dev.warrant</groupId>
<artifactId>warrant-java</artifactId>
<version>x.x.x</version>
</dependency>
Usage:
import dev.warrant.*;
WarrantClient client = new WarrantClient(WarrantConfig.withApiKey("YOUR_KEY"));
Front-end (client-side)
- React
- Vue
- Angular
Install:
npm install @warrantdev/react-warrant-js
Usage:
// App.jsx
import React from "react";
import { WarrantProvider } from "@warrantdev/react-warrant-js";
const App = () => {
return (
<WarrantProvider clientKey="CLIENT_KEY">
{/* Routes, ThemeProviders, etc. */}
</WarrantProvider>
);
};
export default App;
Install:
npm install @warrantdev/vue-warrant
Usage:
// main.js
import Vue from "vue";
import router from "./router";
import App from "./App.vue";
import { Warrant } from "@warrantdev/vue-warrant";
Vue.config.productionTip = false;
Vue.use(Warrant, {
clientKey: "CLIENT_KEY",
});
new Vue({
router,
// store,
render: h => h(App)
}).$mount("#app");
Install:
npm install @warrantdev/angular-warrant
Usage:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
// Import the module from the SDK
import { WarrantModule } from 'angular-warrant';
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
// Import the module into the application, with configuration
WarrantModule.forRoot({
clientKey: "CLIENT_KEY",
}),
],
bootstrap: [AppComponent],
})
export class AppModule {}
Implementing Authz
Now that you have an account and API access, you need to set up your application's authorization model. This consists of the following steps:
- Create object types that represent your authorization model
- Create warrants (access rules) based on that model
- Add access checks to your application to enforce the model