-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add fluent api, stop exporting SkipSSLValidation
- Loading branch information
1 parent
716bd4d
commit 513ae24
Showing
26 changed files
with
603 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,56 @@ | ||
# `go-uaa` [](https://travis-ci.org/cloudfoundry-community/go-uaa) [](http://godoc.org/github.com/cloudfoundry-community/go-uaa) [](https://goreportcard.com/report/github.com/cloudfoundry-community/go-uaa) | ||
# `go-uaa` [](https://travis-ci.org/cloudfoundry-community/go-uaa) [](http://godoc.org/github.com/cloudfoundry-community/go-uaa) [](https://goreportcard.com/report/github.com/cloudfoundry-community/go-uaa) | ||
|
||
### Overview | ||
|
||
`go-uaa` is a client library for the [UAA API](https://docs.cloudfoundry.org/api/uaa/). | ||
`go-uaa` is a client library for the [UAA API](https://docs.cloudfoundry.org/api/uaa/). It is a [`go module`](https://github.com/golang/go/wiki/Modules). | ||
|
||
### Usage | ||
|
||
#### Step 1: Add `go-uaa` As A Dependency | ||
``` | ||
go get -u github.com/cloudfoundry-community/go-uaa | ||
$ 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.12 | ||
require github.com/cloudfoundry-community/go-uaa latest | ||
``` | ||
|
||
#### Step 2: Construct and Use `uaa.API` | ||
|
||
```bash | ||
$ cat main.go | ||
``` | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
uaa "github.com/cloudfoundry-community/go-uaa" | ||
) | ||
|
||
func main() { | ||
// construct the API, and validate it | ||
api := uaa.New("https://uaa.example.net", "").WithClientCredentials("client-id", "client-secret", uaa.JSONWebToken) | ||
err := api.Validate() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// use the API to fetch a user | ||
user, err := api.GetUserByUsername("[email protected]", "uaa", "") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
log.Printf("Hello, %s\n", user.Name.GivenName) | ||
} | ||
``` | ||
|
||
### Experimental | ||
|
Oops, something went wrong.