diff --git a/internal/configuration/validator/notifier_test.go b/internal/configuration/validator/notifier_test.go index dbecbf4d8..c22b2494f 100644 --- a/internal/configuration/validator/notifier_test.go +++ b/internal/configuration/validator/notifier_test.go @@ -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 diff --git a/internal/handlers/handler_firstfactor.go b/internal/handlers/handler_firstfactor.go index ecf143c0b..967a9953f 100644 --- a/internal/handlers/handler_firstfactor.go +++ b/internal/handlers/handler_firstfactor.go @@ -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) { diff --git a/internal/handlers/handler_firstfactor_test.go b/internal/handlers/handler_firstfactor_test.go index 55499f320..e2864279e 100644 --- a/internal/handlers/handler_firstfactor_test.go +++ b/internal/handlers/handler_firstfactor_test.go @@ -346,11 +346,14 @@ 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 +// +// 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. +// +// the user should be redirected to the default url. func (s *FirstFactorRedirectionSuite) TestShouldRedirectToDefaultURLWhenNoTargetURLProvidedAndTwoFactorDisabled() { s.mock.Ctx.Request.SetBodyString(`{ "username": "test", @@ -365,11 +368,14 @@ 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 +// +// 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. +// +// the user should be redirected to the default url. func (s *FirstFactorRedirectionSuite) TestShouldRedirectToDefaultURLWhenURLIsUnsafeAndTwoFactorDisabled() { s.mock.Ctx.Request.SetBodyString(`{ "username": "test", @@ -386,9 +392,12 @@ func (s *FirstFactorRedirectionSuite) TestShouldRedirectToDefaultURLWhenURLIsUns } // When: -// 1/ two_factor is enabled (default policy) +// +// 1/ two_factor is enabled (default policy) +// // Then: -// the user should receive 200 without redirection URL. +// +// the user should receive 200 without redirection URL. func (s *FirstFactorRedirectionSuite) TestShouldReply200WhenNoTargetURLProvidedAndTwoFactorEnabled() { s.mock.Ctx.Providers.Authorizer = authorization.NewAuthorizer(&schema.Configuration{ AccessControl: schema.AccessControlConfiguration{ @@ -409,9 +418,12 @@ func (s *FirstFactorRedirectionSuite) TestShouldReply200WhenNoTargetURLProvidedA } // When: -// 1/ two_factor is enabled (some rule) +// +// 1/ two_factor is enabled (some rule) +// // Then: -// the user should receive 200 without redirection URL. +// +// the user should receive 200 without redirection URL. func (s *FirstFactorRedirectionSuite) TestShouldReply200WhenUnsafeTargetURLProvidedAndTwoFactorEnabled() { s.mock.Ctx.Providers.Authorizer = authorization.NewAuthorizer(&schema.Configuration{ AccessControl: schema.AccessControlConfiguration{ diff --git a/internal/handlers/handler_oidc_consent.go b/internal/handlers/handler_oidc_consent.go index aa6bc3f31..5b34ffea8 100644 --- a/internal/handlers/handler_oidc_consent.go +++ b/internal/handlers/handler_oidc_consent.go @@ -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 diff --git a/internal/model/totp_configuration_test.go b/internal/model/totp_configuration_test.go index 8c6878494..81d82aed3 100644 --- a/internal/model/totp_configuration_test.go +++ b/internal/model/totp_configuration_test.go @@ -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{ diff --git a/internal/oidc/types.go b/internal/oidc/types.go index 051318b38..02078b914 100644 --- a/internal/oidc/types.go +++ b/internal/oidc/types.go @@ -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,7 +515,8 @@ 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 +// +// OpenID Connect Front-Channel Logout: https://openid.net/specs/openid-connect-frontchannel-1_0.html#OPLogout type OpenIDConnectFrontChannelLogoutDiscoveryOptions struct { /* OPTIONAL. Boolean value specifying whether the OP supports HTTP-based logout, with true indicating support. If @@ -533,7 +535,8 @@ 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 +// +// OpenID Connect Back-Channel Logout: https://openid.net/specs/openid-connect-backchannel-1_0.html#BCSupport type OpenIDConnectBackChannelLogoutDiscoveryOptions struct { /* OPTIONAL. Boolean value specifying whether the OP supports back-channel logout, with true indicating support. diff --git a/internal/storage/sql_provider_schema.go b/internal/storage/sql_provider_schema.go index b3cf02892..490aba5c6 100644 --- a/internal/storage/sql_provider_schema.go +++ b/internal/storage/sql_provider_schema.go @@ -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 { diff --git a/internal/utils/version.go b/internal/utils/version.go index 38c438191..3e051d708 100644 --- a/internal/utils/version.go +++ b/internal/utils/version.go @@ -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 -dirty. Otherwise the following is the +// BuildTag i.e. v1.0.0. If dirty and tagged are present it returns -dirty. Otherwise, the following is the // format: untagged--dirty- (, ). -// func Version() (versionString string) { return version(BuildTag, BuildState, BuildCommit, BuildBranch, BuildExtra) }