Skip to content

cloudfoundry/go-uaa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-uaa Travis-CI godoc Report card

Overview

go-uaa is a client library for the UAA API. It is a go module.

Usage

Step 1: Add go-uaa As A Dependency

$ go mod init # optional
$ go get -u github.com/cloudfoundry-community/go-uaa
$ cat go.mod
module github.com/cloudfoundry-community/go-uaa/cmd/test

go 1.13

require github.com/cloudfoundry-community/go-uaa latest

Step 2: Construct and Use uaa.API

Construct a uaa.API by using uaa.New(target string, authOpt AuthenticationOption, opts ...Option):

$ cat main.go
package main

import (
	"log"

	uaa "github.com/cloudfoundry-community/go-uaa"
)

func main() {
	// construct the API
	api, err := uaa.New(
		"https://uaa.example.net",
		uaa.WithClientCredentials("client-id", "client-secret", uaa.JSONWebToken),
	)
	if err != nil {
		log.Fatal(err)
	}

	// use the API to fetch a user
	user, err := api.GetUserByUsername("test@example.net", "uaa", "")
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("Hello, %s\n", user.Name.GivenName)
}

Experimental

  • For the foreseeable future, releases will be in the v0.x.y range
  • You should expect breaking changes until v1.x.y releases occur
  • Notifications of breaking changes will be made via release notes associated with each tag
  • You should use go modules with this package

Contributing

Pull requests welcome.