-
Notifications
You must be signed in to change notification settings - Fork 1
/
doc.go
50 lines (38 loc) · 1.25 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Package warrant provides a library of functionality for interacting with the UAA service.
The library supports management of users, clients, groups and tokens.
Example
Warrant can be used in a variety of ways. Here is a simple example to get you started:
import (
"log"
"github.com/pivotal-cf-experimental/warrant"
)
func main() {
w := warrant.New(warrant.Config{
Host: "https://uaa.example.com",
})
clientToken, err := w.Clients.GetToken("admin", "admin-secret")
if err != nil {
log.Fatalf("Unable to fetch client token: %s", err)
}
user, err := w.Users.Create("my-user", "[email protected]", clientToken)
if err != nil {
log.Fatalf("Unable to create user: %s", err)
}
err = w.Users.SetPassword(user.ID, "my-password", clientToken)
if err != nil {
log.Fatalf("Unable to set user password: %s", err)
}
userToken, err := w.Users.GetToken("my-user", "my-password")
if err != nil {
log.Fatalf("Unable to fetch user token: %s", err)
}
decodedToken, err := w.Tokens.Decode(userToken)
if err != nil {
log.Fatalf("Unable to decode user token: %s", err)
}
log.Printf("%+v\n", decodedToken)
// => {ClientID:cf, UserID:80d4fd0b-119f-4fc7-a800-eb186bc8e766, Scopes:[openid, cloud_controller.read]}
}
*/
package warrant