Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #8 from LF-Engineering/auth0
Browse files Browse the repository at this point in the history
add auth0 library
  • Loading branch information
aultron authored Nov 2, 2021
2 parents 3d6e83c + cca0e1b commit 930a6c3
Show file tree
Hide file tree
Showing 5 changed files with 628 additions and 0 deletions.
94 changes: 94 additions & 0 deletions auth0/dto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package auth0

import "time"

// AuthToken Struct
type AuthToken struct {
Name string `json:"name"`
Token string `json:"token"`
CreatedAt time.Time `json:"created_at"`
}

// Resp struct
type Resp struct {
AccessToken string `json:"access_token"`
Scope string `json:"scope"`
ExpiresIn int `json:"expires_in"`
TokenType string `json:"token_type"`
}

// ESTokenSchema for AuthToken
type ESTokenSchema struct {
Took int `json:"took"`
TimedOut bool `json:"timed_out"`
Shards struct {
Total int `json:"total"`
Successful int `json:"successful"`
Skipped int `json:"skipped"`
Failed int `json:"failed"`
} `json:"_shards"`
Hits struct {
Total struct {
Value int `json:"value"`
Relation string `json:"relation"`
} `json:"total"`
MaxScore float64 `json:"max_score"`
Hits []struct {
Index string `json:"_index"`
Type string `json:"_type"`
ID string `json:"_id"`
Score float64 `json:"_score"`
Source struct {
Name string `json:"name"`
Token string `json:"token"`
} `json:"_source"`
} `json:"hits"`
} `json:"hits"`
}

// LastActionSchema ...
type LastActionSchema struct {
Took int `json:"took"`
TimedOut bool `json:"timed_out"`
Shards struct {
Total int `json:"total"`
Successful int `json:"successful"`
Skipped int `json:"skipped"`
Failed int `json:"failed"`
} `json:"_shards"`
Hits struct {
Total struct {
Value int `json:"value"`
Relation string `json:"relation"`
} `json:"total"`
MaxScore float64 `json:"max_score"`
Hits []struct {
Index string `json:"_index"`
Type string `json:"_type"`
ID string `json:"_id"`
Score float64 `json:"_score"`
Source struct {
Date time.Time `json:"date"`
} `json:"_source"`
} `json:"hits"`
} `json:"hits"`
}

const (
lastTokenDate = "last-token-date"
lastAuth0TokenRequest = "last-auth0-token-request-"
auth0TokenCache = "auth0-token-cache-"
tokenDoc = "token"
)

// RefreshResult ...
type RefreshResult string

const (
// RefreshError ...
RefreshError RefreshResult = "error refreshing auth0 token"
// RefreshSuccessful ...
RefreshSuccessful RefreshResult = "token refreshed successfully"
// NotExpireSoon ...
NotExpireSoon RefreshResult = "token will not expire soon"
)
93 changes: 93 additions & 0 deletions auth0/mocks/es_client_provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions auth0/mocks/http_client_provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions auth0/mocks/slack_provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 930a6c3

Please sign in to comment.