Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/orisano/go-adal

unofficial Active Directory Authentication Library for go
https://github.com/orisano/go-adal

active-directory adal authentication azure-ad golang

Last synced: 7 days ago
JSON representation

unofficial Active Directory Authentication Library for go

Awesome Lists containing this project

README

        

# go-ADAL
[![Build Status](https://app.travis-ci.com/orisano/go-adal.svg?branch=master)](https://app.travis-ci.com/orisano/go-adal)
Code Climate

unofficial Active Directory Authentication Library for go.

## Installation
```
go get github.com/orisano/go-adal
```

## How to Use
```go
package main

import (
"context"
"io"
"log"
"os"

"github.com/orisano/go-adal"
)

const (
tenant = "common"
resource = "resource.example"
clientID = "xxxxxxxxxxxxxxxxx"
clientSecret = "xxxxxxxxxxxxxxxxx"
)

func main() {
ac, err := adal.NewAuthenticationContext(tenant)
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
client, err := ac.Client(ctx, resource, clientID, clientSecret)
if err != nil {
log.Fatal(err)
}
resp, err := client.Get("http://api.example/v1/resource")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()

io.Copy(os.Stdout, resp.Body)
}
```

## Author
Nao Yonashiro (@orisano)

## License
MIT