crowd

package
v0.0.0-...-321c0bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2019 License: MIT, Apache-2.0 Imports: 7 Imported by: 0

README

go-crowd

Go library for interacting with Atlassian Crowd

Client example

client, err := crowd.New("crowd_app_user", 
                        "crowd_app_password", 
                        "crowd service URL")

user, err := client.Authenticate("testuser", "testpass")
if err != nil {
    /*
    failure or reject from crowd. check if err = reason from 
    https://developer.atlassian.com/display/CROWDDEV/Using+the+Crowd+REST+APIs#UsingtheCrowdRESTAPIs-HTTPResponseCodesandErrorResponses
    */
}

// if auth successful, user contains user information

Documentation

Overview

Package crowd provides methods for interacting with the Atlassian Crowd authentication, directory integration, and Single Sign-On system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CookieConfig

type CookieConfig struct {
	XMLName struct{} `xml:"cookie-config"`
	Domain  string   `xml:"domain"`
	Secure  bool     `xml:"secure"`
	Name    string   `xml:"name"`
}

CookieConfig holds configuration values needed to set a Crowd SSO cookie.

type Crowd

type Crowd struct {
	// contains filtered or unexported fields
}

Crowd represents your Crowd (client) Application settings

func New

func New(appuser string, apppass string, baseurl string) (Crowd, error)

New initializes & returns a Crowd object.

func (*Crowd) Authenticate

func (c *Crowd) Authenticate(user string, pass string) (User, error)

Authenticate a user & password against Crowd. Returns error on failure or account lockout. Success is a populated User with nil error.

func (*Crowd) GetCookieConfig

func (c *Crowd) GetCookieConfig() (CookieConfig, error)

GetCookieConfig returns settings needed to set a Crowd SSO cookie.

type Error

type Error struct {
	XMLName struct{} `xml:"error"`
	Reason  string   `xml:"reason"`
	Message string   `xml:"message"`
}

Error represents a error response from Crowd. Error reasons are documented at https://developer.atlassian.com/display/CROWDDEV/Using+the+Crowd+REST+APIs#UsingtheCrowdRESTAPIs-HTTPResponseCodesandErrorResponses

type User

type User struct {
	XMLName     struct{} `xml:"user"`
	UserName    string   `xml:"name,attr"`
	FirstName   string   `xml:"first-name"`
	LastName    string   `xml:"last-name"`
	DisplayName string   `xml:"display-name"`
	Email       string   `xml:"email"`
	Active      bool     `xml:"active"`
	Key         string   `xml:"key"`
}

User represents a user in Crowd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL