File tree Expand file tree Collapse file tree 6 files changed +12
-10
lines changed Expand file tree Collapse file tree 6 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -312,7 +312,7 @@ Configure authentication in `config/mcp-server.php`:
312312
313313** Available Drivers:**
314314
315- - ** ` none ` ** (Development): No authentication required - useful for development and testing
315+ - ** ` null ` ** (Development): No authentication required - useful for development and testing
316316- ** ` sanctum ` ** (Recommended): Laravel Sanctum token authentication
317317- ** ` passport ` ** (Enterprise): Laravel Passport OAuth2 authentication
318318- ** ` custom ` ** (Advanced): Custom authentication provider implementation
Original file line number Diff line number Diff line change 232232 | AUTHENTICATION METHODS:
233233 | ======================
234234 |
235- | 'none' : No authentication (development only)
235+ | null : No authentication (development only)
236236 | 'sanctum': Laravel Sanctum token authentication
237237 | 'passport': Laravel Passport OAuth2 authentication
238238 | 'jwt': JWT token authentication (requires tymon/jwt-auth)
246246 |----------------------------------------------------------------------
247247 |
248248 | The authentication method to use. Available drivers:
249- | - 'none' : No authentication (development only)
249+ | - null : No authentication (development only)
250250 | - 'sanctum': Laravel Sanctum token authentication (recommended)
251251 | - 'passport': Laravel Passport OAuth2 authentication (enterprise)
252252 | - 'custom': Custom authentication provider
253253 |
254254 | Environment examples:
255- | - Development: 'none'
255+ | - Development: null
256256 | - Production API: 'sanctum'
257257 | - Enterprise SSO: 'passport'
258258 |
259259 */
260- 'driver ' => ' none ' ,
260+ 'driver ' => null ,
261261
262262 /*
263263 |----------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ class AuthManager extends Manager
1212{
1313 public function getDefaultDriver (): string
1414 {
15- return $ this ->config ->get ('mcp-server.auth.driver ' , 'none ' );
15+ $ driver = $ this ->config ->get ('mcp-server.auth.driver ' );
16+ return $ driver ?: 'none ' ;
1617 }
1718
1819 public function createNoneDriver (): AuthProvider
Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ trait AuthConfigHelper
1414 */
1515 protected function isAuthEnabled (): bool
1616 {
17- return config ('mcp-server.auth.driver ' , 'none ' ) !== 'none ' ;
17+ $ driver = config ('mcp-server.auth.driver ' );
18+ return !empty ($ driver );
1819 }
1920
2021 /**
Original file line number Diff line number Diff line change 1111 $ this ->middleware = new McpAuthenticate ($ this ->authManager );
1212});
1313
14- it ('skips authentication when driver is none ' , function () {
15- config (['mcp-server.auth.driver ' => ' none ' ]);
14+ it ('skips authentication when driver is null ' , function () {
15+ config (['mcp-server.auth.driver ' => null ]);
1616
1717 $ request = Request::create ('/test ' , 'POST ' , ['id ' => 123 ]);
1818 $ next = fn ($ req ) => response ()->json (['success ' => true ]);
Original file line number Diff line number Diff line change 1616});
1717
1818it ('skips rate limiting when auth is disabled ' , function () {
19- config (['mcp-server.auth.driver ' => ' none ' ]);
19+ config (['mcp-server.auth.driver ' => null ]);
2020
2121 $ request = Request::create ('/test ' , 'POST ' , ['id ' => 123 ]);
2222 $ next = fn ($ req ) => response ()->json (['success ' => true ]);
You can’t perform that action at this time.
0 commit comments