Skip to content


Folders and files

Last commit message
Last commit date

Latest commit



11 Commits

Repository files navigation

Okta Role Manager Build Status Coverage Status Godoc

Okta Role Manager is the Okta role manager for Casbin. With this library, Casbin can load role hierarchy (user-role mapping) from Okta or save role hierarchy to it (NOT Implemented).


go get

Simple Example

package main

import (

func main() {
	// This role manager dose not rely on Casbin policy. So we should not
	// specify grouping policy ("g" policy rules) in the .csv file.
	e := casbin.NewEnforcer("examples/rbac_model.conf", "examples/rbac_policy.csv")

	// Use our role manager.
	// orgName is your organization name.
	// apiToken is the token you created in the Admin portal.
	// For example, if your domain name is like:,
	// then your orgName is dev-123456, isProductionOrPreview is false.
	// If your domain name is like:, then your orgName
	// is company_name, isProductionOrPreview is true.
	rm := oktarolemanager.NewRoleManager("dev-000000", "your_api_token", false)

	// If our role manager relies on Casbin policy (like reading "g"
	// policy rules), then we have to set the role manager before loading
	// policy.
	// Otherwise, we can set the role manager at any time, because role
	// manager has nothing to do with the adapter.
	// Check the permission.
	// Casbin's subject (user) name uses the Okta user's login field (aka Email address).
	// Casbin's role name uses the Okta group's name field (like "Admin", "Everyone").
	e.Enforce("", "data1", "read")

Getting Help


This project is under Apache 2.0 License. See the LICENSE file for the full license text.