Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mvader/slackauth
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Molina committed Aug 19, 2016
2 parents 2856751 + e31e3e7 commit 3ac4004
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ script:
- go test -cover -coverprofile=coverage.txt -covermode=atomic .

after_success:
- bash <(curl -s https://codecov.io/bash
- bash <(curl -s https://codecov.io/bash)
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<img src="https://raw.githubusercontent.com/mvader/slackauth/master/logo.svg" alt="slackauth" />
<img src="https://rawgit.com/mvader/slackauth/master/logo.svg" alt="slackauth" />

[![godoc reference](https://cdn.rawgit.com/mvader/2faf5060e6cb109617ef5548836532aa/raw/2f5e2f2e934f6dde4ec4652ff0ae6d5c83cbfd6a/godoc.svg)](https://godoc.org/github.com/mvader/slackauth) [![Build Status](https://travis-ci.org/mvader/slackauth.svg?branch=master)](https://travis-ci.org/mvader/slackauth) [![codecov](https://codecov.io/gh/mvader/slackauth/branch/master/graph/badge.svg)](https://codecov.io/gh/mvader/slackauth) [![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)

**slackauth** is a package to implement the ["Add to Slack"](https://api.slack.com/docs/slack-button) button functionality in an easy way.

## Install

```
go get gopkg.in/mvader/slackauth.v1
```

## Example

```go
Expand Down
16 changes: 15 additions & 1 deletion auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,25 @@ type slackAuth struct {

// Options has all the configurable parameters for slack authenticator.
type Options struct {
// Addr is the address where the service will run. e.g: :8080, 0.0.0.0:8989, etc.
Addr string
// ClientID is the slack client ID provided to you in your app credentials.
ClientID string
// ClientSecret is the slack client secret provided to you in your app credentials.
ClientSecret string
// SuccessTpl is the path to the template that will be displayed when there is a successful
// auth.
SuccessTpl string
// ErrorTpl is the path to the template that will be displayed when there is an invalid
// auth.
ErrorTpl string
// Debug will print some debug logs.
Debug bool
// CertFile is the path to the SSL certificate file. If this and KeyFile are provided, the
// server will be run with SSL.
CertFile string
// KeyFile is the path to the SSL certificate key file. If this and CertFile are provided, the
// server will be run with SSL.
KeyFile string
}

Expand Down Expand Up @@ -108,6 +120,7 @@ func (s *slackAuth) Run() error {
}
}()

log15.Info("Starting server", "addr", s.addr)
return s.runServer()
}

Expand Down Expand Up @@ -160,7 +173,8 @@ func (s *slackAuth) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if err := s.successTpl.Execute(w, resp); err != nil {
log15.Error("error displaying success tpl", "err", err.Error())
}


log15.Debug("successful authorization", "team", resp.TeamName, "team id", resp.TeamID)
s.auths <- resp
}

Expand Down

0 comments on commit 3ac4004

Please sign in to comment.