Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Aug 4, 2022
1 parent 89f1e8a commit 1acbf1a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 28 deletions.
8 changes: 0 additions & 8 deletions pkg/api/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,6 @@ func createClient(db *gorm.DB) http.HandlerFunc {
return
}

grantTypes := []oidc.GrantType{
oidc.GrantTypeCode,
oidc.GrantTypeRefreshToken,
}
if !opts.Public {
grantTypes = append(grantTypes, oidc.GrantTypeClientCredentials)
}

c := auth.NewClient(*opts)
if err := createObject(w, r, db, c); err != nil {
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"

"github.com/numary/auth/pkg/delegatedauth"
"github.com/numary/go-libs/sharedhealth/pkg"
sharedhealth "github.com/numary/go-libs/sharedhealth/pkg"
)

func delegatedOIDCServerAvailability(issuer delegatedauth.Issuer) sharedhealth.NamedCheck {
Expand Down
2 changes: 1 addition & 1 deletion pkg/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type ClientSecret struct {
ID string `json:"id"`
Hash string `json:"hash"`
LastDigits string `json:"lastDigits"`
Name string `json:"lastDigits"`
Name string `json:"name"`
}

func (s ClientSecret) Check(clear string) bool {
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"time"

"github.com/numary/auth/pkg"
auth "github.com/numary/auth/pkg"
"github.com/numary/go-libs/sharedlogging"
"go.uber.org/fx"
"gorm.io/driver/postgres"
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package storage
import (
"time"

"github.com/numary/auth/pkg"
auth "github.com/numary/auth/pkg"
)

type RefreshTokenRequest struct {
Expand Down
19 changes: 3 additions & 16 deletions pkg/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import (
"time"

"github.com/google/uuid"
"github.com/numary/auth/pkg"
auth "github.com/numary/auth/pkg"
"github.com/numary/auth/pkg/delegatedauth"
"github.com/zitadel/oidc/pkg/oidc"
"github.com/zitadel/oidc/pkg/op"
"golang.org/x/text/language"
"gopkg.in/square/go-jose.v2"
"gorm.io/gorm"

"github.com/zitadel/oidc/pkg/oidc"
"github.com/zitadel/oidc/pkg/op"
)

type Storage interface {
Expand Down Expand Up @@ -474,14 +473,6 @@ func (s *storage) createRefreshToken(tx *gorm.DB, accessToken *auth.Token, amr [
Error
}

//renewRefreshToken checks the provided refresh_token and creates a new one based on the current
func (s *storage) renewRefreshToken(tx *gorm.DB, currentRefreshToken string, newToken string) error {
return tx.
Model(&auth.RefreshToken{}).
Where("id = ?", currentRefreshToken).
Update("token", newToken).Error
}

//accessToken will store an access_token in-memory based on the provided information
func (s *storage) saveAccessToken(tx *gorm.DB, applicationID, subject string, audience, scopes []string) (*auth.Token, error) {
token := &auth.Token{
Expand All @@ -497,10 +488,6 @@ func (s *storage) saveAccessToken(tx *gorm.DB, applicationID, subject string, au
Error
}

func (s *storage) deleteAccessToken(tx *gorm.DB, id string) error {
return tx.Where("id = ?", id).Delete(&auth.Token{}).Error
}

//setUserinfo sets the info based on the user, scopes and if necessary the clientID
func (s *storage) setUserinfo(ctx context.Context, userInfo oidc.UserInfoSetter, userID, clientID string, scopes []string) (err error) {

Expand Down

0 comments on commit 1acbf1a

Please sign in to comment.