refactor: fix linter directives for go 1.19 and golangci-lint 1.48.0 (#3798)
parent
c585e19499
commit
2d26b4e115
|
@ -29,7 +29,7 @@ func (suite *NotifierSuite) SetupTest() {
|
|||
}
|
||||
|
||||
/*
|
||||
Common Tests.
|
||||
Common Tests.
|
||||
*/
|
||||
func (suite *NotifierSuite) TestShouldEnsureAtLeastSMTPOrFilesystemIsProvided() {
|
||||
ValidateNotifier(&suite.config, suite.validator)
|
||||
|
@ -69,7 +69,7 @@ func (suite *NotifierSuite) TestShouldEnsureEitherSMTPOrFilesystemIsProvided() {
|
|||
}
|
||||
|
||||
/*
|
||||
SMTP Tests.
|
||||
SMTP Tests.
|
||||
*/
|
||||
func (suite *NotifierSuite) TestSMTPShouldSetTLSDefaults() {
|
||||
ValidateNotifier(&suite.config, suite.validator)
|
||||
|
@ -146,7 +146,7 @@ func (suite *NotifierSuite) TestSMTPShouldEnsureSenderIsProvided() {
|
|||
}
|
||||
|
||||
/*
|
||||
File Tests.
|
||||
File Tests.
|
||||
*/
|
||||
func (suite *NotifierSuite) TestFileShouldEnsureFilenameIsProvided() {
|
||||
suite.config.SMTP = nil
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
)
|
||||
|
||||
// FirstFactorPOST is the handler performing the first factory.
|
||||
//
|
||||
//nolint:gocyclo // TODO: Consider refactoring time permitting.
|
||||
func FirstFactorPOST(delayFunc middlewares.TimingAttackDelayFunc) middlewares.RequestHandler {
|
||||
return func(ctx *middlewares.AutheliaCtx) {
|
||||
|
|
|
@ -346,10 +346,13 @@ func (s *FirstFactorRedirectionSuite) TearDownTest() {
|
|||
}
|
||||
|
||||
// When:
|
||||
//
|
||||
// 1/ the target url is unknown
|
||||
// 2/ two_factor is disabled (no policy is set to two_factor)
|
||||
// 3/ default_redirect_url is provided
|
||||
//
|
||||
// Then:
|
||||
//
|
||||
// the user should be redirected to the default url.
|
||||
func (s *FirstFactorRedirectionSuite) TestShouldRedirectToDefaultURLWhenNoTargetURLProvidedAndTwoFactorDisabled() {
|
||||
s.mock.Ctx.Request.SetBodyString(`{
|
||||
|
@ -365,10 +368,13 @@ func (s *FirstFactorRedirectionSuite) TestShouldRedirectToDefaultURLWhenNoTarget
|
|||
}
|
||||
|
||||
// When:
|
||||
//
|
||||
// 1/ the target url is unsafe
|
||||
// 2/ two_factor is disabled (no policy is set to two_factor)
|
||||
// 3/ default_redirect_url is provided
|
||||
//
|
||||
// Then:
|
||||
//
|
||||
// the user should be redirected to the default url.
|
||||
func (s *FirstFactorRedirectionSuite) TestShouldRedirectToDefaultURLWhenURLIsUnsafeAndTwoFactorDisabled() {
|
||||
s.mock.Ctx.Request.SetBodyString(`{
|
||||
|
@ -386,8 +392,11 @@ func (s *FirstFactorRedirectionSuite) TestShouldRedirectToDefaultURLWhenURLIsUns
|
|||
}
|
||||
|
||||
// When:
|
||||
//
|
||||
// 1/ two_factor is enabled (default policy)
|
||||
//
|
||||
// Then:
|
||||
//
|
||||
// the user should receive 200 without redirection URL.
|
||||
func (s *FirstFactorRedirectionSuite) TestShouldReply200WhenNoTargetURLProvidedAndTwoFactorEnabled() {
|
||||
s.mock.Ctx.Providers.Authorizer = authorization.NewAuthorizer(&schema.Configuration{
|
||||
|
@ -409,8 +418,11 @@ func (s *FirstFactorRedirectionSuite) TestShouldReply200WhenNoTargetURLProvidedA
|
|||
}
|
||||
|
||||
// When:
|
||||
//
|
||||
// 1/ two_factor is enabled (some rule)
|
||||
//
|
||||
// Then:
|
||||
//
|
||||
// the user should receive 200 without redirection URL.
|
||||
func (s *FirstFactorRedirectionSuite) TestShouldReply200WhenUnsafeTargetURLProvidedAndTwoFactorEnabled() {
|
||||
s.mock.Ctx.Providers.Authorizer = authorization.NewAuthorizer(&schema.Configuration{
|
||||
|
|
|
@ -48,8 +48,9 @@ func OpenIDConnectConsentGET(ctx *middlewares.AutheliaCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
//nolint:gocyclo
|
||||
// OpenIDConnectConsentPOST handles consent responses for OpenID Connect.
|
||||
//
|
||||
//nolint:gocyclo // TODO: Consider refactoring time permitting.
|
||||
func OpenIDConnectConsentPOST(ctx *middlewares.AutheliaCtx) {
|
||||
var (
|
||||
consentID uuid.UUID
|
||||
|
|
|
@ -9,12 +9,12 @@ import (
|
|||
)
|
||||
|
||||
/*
|
||||
TestShouldOnlyMarshalPeriodAndDigitsAndAbsolutelyNeverSecret.
|
||||
This test is vital to ensuring the TOTP configuration is marshalled correctly. If encoding/json suddenly changes
|
||||
upstream and the json tag value of '-' doesn't exclude the field from marshalling then this test will pickup this
|
||||
issue prior to code being shipped.
|
||||
TestShouldOnlyMarshalPeriodAndDigitsAndAbsolutelyNeverSecret.
|
||||
This test is vital to ensuring the TOTP configuration is marshalled correctly. If encoding/json suddenly changes
|
||||
upstream and the json tag value of '-' doesn't exclude the field from marshalling then this test will pickup this
|
||||
issue prior to code being shipped.
|
||||
|
||||
For this reason it's essential that the marshalled object contains all values populated, especially the secret.
|
||||
For this reason it's essential that the marshalled object contains all values populated, especially the secret.
|
||||
*/
|
||||
func TestShouldOnlyMarshalPeriodAndDigitsAndAbsolutelyNeverSecret(t *testing.T) {
|
||||
object := TOTPConfiguration{
|
||||
|
|
|
@ -156,6 +156,7 @@ type ConsentPostResponseBody struct {
|
|||
/*
|
||||
CommonDiscoveryOptions represents the discovery options used in both OAuth 2.0 and OpenID Connect.
|
||||
See Also:
|
||||
|
||||
OpenID Connect Discovery: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
|
||||
OAuth 2.0 Discovery: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-discovery-10#section-2
|
||||
*/
|
||||
|
@ -514,6 +515,7 @@ type OpenIDConnectDiscoveryOptions struct {
|
|||
// OpenIDConnectFrontChannelLogoutDiscoveryOptions represents the discovery options specific to
|
||||
// OpenID Connect Front-Channel Logout functionality.
|
||||
// See Also:
|
||||
//
|
||||
// OpenID Connect Front-Channel Logout: https://openid.net/specs/openid-connect-frontchannel-1_0.html#OPLogout
|
||||
type OpenIDConnectFrontChannelLogoutDiscoveryOptions struct {
|
||||
/*
|
||||
|
@ -533,6 +535,7 @@ type OpenIDConnectFrontChannelLogoutDiscoveryOptions struct {
|
|||
// OpenIDConnectBackChannelLogoutDiscoveryOptions represents the discovery options specific to
|
||||
// OpenID Connect Back-Channel Logout functionality.
|
||||
// See Also:
|
||||
//
|
||||
// OpenID Connect Back-Channel Logout: https://openid.net/specs/openid-connect-backchannel-1_0.html#BCSupport
|
||||
type OpenIDConnectBackChannelLogoutDiscoveryOptions struct {
|
||||
/*
|
||||
|
|
|
@ -133,7 +133,7 @@ func (p *SQLProvider) SchemaMigrate(ctx context.Context, up bool, version int) (
|
|||
return p.schemaMigrate(ctx, currentVersion, version)
|
||||
}
|
||||
|
||||
//nolint: gocyclo
|
||||
//nolint:gocyclo // TODO: Consider refactoring time permitting.
|
||||
func (p *SQLProvider) schemaMigrate(ctx context.Context, prior, target int) (err error) {
|
||||
migrations, err := loadMigrations(p.name, prior, target)
|
||||
if err != nil {
|
||||
|
|
|
@ -32,9 +32,8 @@ var BuildNumber = "0"
|
|||
// Version returns the Authelia version.
|
||||
//
|
||||
// The format of the string is dependent on the values in BuildState. If tagged and clean are present it returns the
|
||||
// BuildTag i.e. v1.0.0. If dirty and tagged are present it returns <BuildTag>-dirty. Otherwise the following is the
|
||||
// BuildTag i.e. v1.0.0. If dirty and tagged are present it returns <BuildTag>-dirty. Otherwise, the following is the
|
||||
// format: untagged-<BuildTag>-dirty-<BuildExtra> (<BuildBranch>, <BuildCommit>).
|
||||
//
|
||||
func Version() (versionString string) {
|
||||
return version(BuildTag, BuildState, BuildCommit, BuildBranch, BuildExtra)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue