diff --git a/changelog.md b/changelog.md index 4bdf4aa..1233689 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Renamed the misspelled `startAuthenticationWorflow()` provider method to `startAuthenticationWorkflow()`. The old name remains as a deprecated alias on `BaseProvider`, and the `start` handler falls back to it for custom providers that only implement the old name. + ## [3.0.0] - 2026-08-26 ## [3.0.0] - 2026-08-25 diff --git a/handlers/Auth.cfc b/handlers/Auth.cfc index e1f9fbb..13873b9 100644 --- a/handlers/Auth.cfc +++ b/handlers/Auth.cfc @@ -23,7 +23,12 @@ component { } function start( event, rc, prc ){ - relocate( url = prc.ssoProvider.startAuthenticationWorflow( event ) ); + // Fall back to the deprecated misspelled method for custom providers written against cbSSO <= 3.0 + if ( structKeyExists( prc.ssoProvider, "startAuthenticationWorkflow" ) ) { + relocate( url = prc.ssoProvider.startAuthenticationWorkflow( event ) ); + } else { + relocate( url = prc.ssoProvider.startAuthenticationWorflow( event ) ); + } } function authorize( event, rc, prc ){ diff --git a/models/ISSOIntegrationProvider.cfc b/models/ISSOIntegrationProvider.cfc index ac2a48d..594151d 100644 --- a/models/ISSOIntegrationProvider.cfc +++ b/models/ISSOIntegrationProvider.cfc @@ -1,7 +1,7 @@ interface { public string function getName(); - public string function startAuthenticationWorflow( required any event ); + public string function startAuthenticationWorkflow( required any event ); public any function processAuthorizationEvent( required any event ); } diff --git a/models/providers/BaseProvider.cfc b/models/providers/BaseProvider.cfc index 09b7d26..12c41f1 100644 --- a/models/providers/BaseProvider.cfc +++ b/models/providers/BaseProvider.cfc @@ -12,4 +12,11 @@ component { return "#event.getHTMLBaseURL()#cbsso/auth/#variables.name.lcase()#"; } + /** + * @deprecated Misspelled alias kept for backward compatibility. Use startAuthenticationWorkflow() instead. Will be removed in the next major release. + */ + public string function startAuthenticationWorflow( required any event ){ + return startAuthenticationWorkflow( arguments.event ); + } + } diff --git a/models/providers/FacebookProvider.cfc b/models/providers/FacebookProvider.cfc index b437a2e..7fa8629 100644 --- a/models/providers/FacebookProvider.cfc +++ b/models/providers/FacebookProvider.cfc @@ -27,7 +27,7 @@ component return variables.name; } - public string function startAuthenticationWorflow( required any event ){ + public string function startAuthenticationWorkflow( required any event ){ return oAuthService.buildAuthUrl( authEndpoint = getAuthEndpoint(), client_id = getClientId(), diff --git a/models/providers/GitHubProvider.cfc b/models/providers/GitHubProvider.cfc index 887527a..b4f311b 100644 --- a/models/providers/GitHubProvider.cfc +++ b/models/providers/GitHubProvider.cfc @@ -27,7 +27,7 @@ component return variables.name; } - public string function startAuthenticationWorflow( required any event ){ + public string function startAuthenticationWorkflow( required any event ){ return oAuthService.buildAuthUrl( authEndpoint = getAuthEndpoint(), client_id = getClientId(), diff --git a/models/providers/GoogleProvider.cfc b/models/providers/GoogleProvider.cfc index 4107afe..ef8add5 100644 --- a/models/providers/GoogleProvider.cfc +++ b/models/providers/GoogleProvider.cfc @@ -25,7 +25,7 @@ component return variables.name; } - public string function startAuthenticationWorflow( required any event ){ + public string function startAuthenticationWorkflow( required any event ){ return oAuthService.buildAuthUrl( authEndpoint = getAuthEndpoint(), client_id = getClientId(), diff --git a/models/providers/MicrosoftSAMLProvider.cfc b/models/providers/MicrosoftSAMLProvider.cfc index 7cd9de5..fbbfe23 100644 --- a/models/providers/MicrosoftSAMLProvider.cfc +++ b/models/providers/MicrosoftSAMLProvider.cfc @@ -42,7 +42,7 @@ component return this; } - public string function startAuthenticationWorflow( required any event ){ + public string function startAuthenticationWorkflow( required any event ){ var encoded = encodeForURL( deflateAndBase64Enocde( getRawSAMLRequest() ) ); return "#variables.authEndpoint#?SAMLRequest=#encoded#"; diff --git a/test-harness/models/CustomProvider.cfc b/test-harness/models/CustomProvider.cfc index 42f1dbc..0a25b67 100644 --- a/test-harness/models/CustomProvider.cfc +++ b/test-harness/models/CustomProvider.cfc @@ -9,7 +9,7 @@ component implements="cbsso.models.ISSOIntegrationProvider" { return ""; } - public string function startAuthenticationWorflow( required any event ){ + public string function startAuthenticationWorkflow( required any event ){ return "http://" & cgi.HTTP_HOST & "/main/fakeIdentityProvider"; } @@ -26,4 +26,11 @@ component implements="cbsso.models.ISSOIntegrationProvider" { .setUserId( "user-456" ); } + /** + * @deprecated Misspelled alias kept for backward compatibility. Use startAuthenticationWorkflow() instead. Will be removed in the next major release. + */ + public string function startAuthenticationWorflow( required any event ){ + return startAuthenticationWorkflow( arguments.event ); + } + } diff --git a/test-harness/tests/specs/AuthHandlerSpec.cfc b/test-harness/tests/specs/AuthHandlerSpec.cfc index 566cd16..bff2bed 100644 --- a/test-harness/tests/specs/AuthHandlerSpec.cfc +++ b/test-harness/tests/specs/AuthHandlerSpec.cfc @@ -59,6 +59,16 @@ component extends="coldbox.system.testing.BaseTestCase" { expect( event.getValue( "relocate_URL", "" ) ).toInclude( "/main/fakeIdentityProvider" ); } ); + it( "keeps the deprecated startAuthenticationWorflow alias working on providers", function(){ + var provider = getInstance( "CustomProvider" ); + expect( provider.startAuthenticationWorflow( getRequestContext() ) ).toBe( + provider.startAuthenticationWorkflow( getRequestContext() ) + ); + var google = getInstance( "GoogleProvider@cbsso" ); + expect( structKeyExists( google, "startAuthenticationWorkflow" ) ).toBeTrue(); + expect( structKeyExists( google, "startAuthenticationWorflow" ) ).toBeTrue(); + } ); + it( "does not announce CBSSOAuthorization for a missing provider", function(){ execute( route = "/cbsso/auth/notaprovider", renderResults = false );