masonite-framework 5.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- masonite_framework-5.0.0/LICENSE +21 -0
- masonite_framework-5.0.0/MANIFEST.in +30 -0
- masonite_framework-5.0.0/PKG-INFO +146 -0
- masonite_framework-5.0.0/README.md +77 -0
- masonite_framework-5.0.0/pyproject.toml +85 -0
- masonite_framework-5.0.0/setup.cfg +4 -0
- masonite_framework-5.0.0/src/masonite/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/api/Api.py +98 -0
- masonite_framework-5.0.0/src/masonite/api/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/api/authentication/AuthenticatesTokens.py +16 -0
- masonite_framework-5.0.0/src/masonite/api/authentication/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/api/commands/APIInstallCommand.py +55 -0
- masonite_framework-5.0.0/src/masonite/api/controllers/AuthenticationController.py +27 -0
- masonite_framework-5.0.0/src/masonite/api/controllers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/api/facades/Api.py +5 -0
- masonite_framework-5.0.0/src/masonite/api/facades/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/api/guards/JWTGuard.py +65 -0
- masonite_framework-5.0.0/src/masonite/api/guards/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/api/middleware/JWTAuthenticationMiddleware.py +24 -0
- masonite_framework-5.0.0/src/masonite/api/middleware/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/api/providers/ApiProvider.py +29 -0
- masonite_framework-5.0.0/src/masonite/api/providers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/api/stubs/api.py +15 -0
- masonite_framework-5.0.0/src/masonite/api/stubs/routes/api.py +0 -0
- masonite_framework-5.0.0/src/masonite/auth/MustVerifyEmail.py +26 -0
- masonite_framework-5.0.0/src/masonite/auth/Sign.py +76 -0
- masonite_framework-5.0.0/src/masonite/auth/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/authentication/Auth.py +195 -0
- masonite_framework-5.0.0/src/masonite/authentication/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/authentication/guards/TestGuard.py +88 -0
- masonite_framework-5.0.0/src/masonite/authentication/guards/WebGuard.py +86 -0
- masonite_framework-5.0.0/src/masonite/authentication/guards/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/authentication/models/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/authentication/models/authenticates.py +76 -0
- masonite_framework-5.0.0/src/masonite/authorization/AuthorizationResponse.py +30 -0
- masonite_framework-5.0.0/src/masonite/authorization/AuthorizesRequest.py +9 -0
- masonite_framework-5.0.0/src/masonite/authorization/Gate.py +170 -0
- masonite_framework-5.0.0/src/masonite/authorization/Policy.py +9 -0
- masonite_framework-5.0.0/src/masonite/authorization/__init__.py +5 -0
- masonite_framework-5.0.0/src/masonite/authorization/models/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/authorization/models/authorizes.py +12 -0
- masonite_framework-5.0.0/src/masonite/broadcasting/Broadcast.py +68 -0
- masonite_framework-5.0.0/src/masonite/broadcasting/CanBroadcast.py +9 -0
- masonite_framework-5.0.0/src/masonite/broadcasting/Channel.py +6 -0
- masonite_framework-5.0.0/src/masonite/broadcasting/PresenceChannel.py +9 -0
- masonite_framework-5.0.0/src/masonite/broadcasting/PrivateChannel.py +9 -0
- masonite_framework-5.0.0/src/masonite/broadcasting/__init__.py +5 -0
- masonite_framework-5.0.0/src/masonite/broadcasting/controllers/BroadcastingController.py +10 -0
- masonite_framework-5.0.0/src/masonite/broadcasting/controllers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/broadcasting/drivers/PusherDriver.py +37 -0
- masonite_framework-5.0.0/src/masonite/broadcasting/drivers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/broadcasting/providers/BroadcastProvider.py +20 -0
- masonite_framework-5.0.0/src/masonite/broadcasting/providers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/cache/Cache.py +56 -0
- masonite_framework-5.0.0/src/masonite/cache/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/cache/drivers/FileDriver.py +109 -0
- masonite_framework-5.0.0/src/masonite/cache/drivers/MemcachedDriver.py +92 -0
- masonite_framework-5.0.0/src/masonite/cache/drivers/RedisDriver.py +185 -0
- masonite_framework-5.0.0/src/masonite/cache/drivers/__init__.py +3 -0
- masonite_framework-5.0.0/src/masonite/commands/AuthCommand.py +48 -0
- masonite_framework-5.0.0/src/masonite/commands/Command.py +7 -0
- masonite_framework-5.0.0/src/masonite/commands/CommandCapsule.py +36 -0
- masonite_framework-5.0.0/src/masonite/commands/DownCommand.py +15 -0
- masonite_framework-5.0.0/src/masonite/commands/Entry.py +24 -0
- masonite_framework-5.0.0/src/masonite/commands/InstallCommand.py +51 -0
- masonite_framework-5.0.0/src/masonite/commands/KeyCommand.py +33 -0
- masonite_framework-5.0.0/src/masonite/commands/MakeCommandCommand.py +50 -0
- masonite_framework-5.0.0/src/masonite/commands/MakeControllerCommand.py +89 -0
- masonite_framework-5.0.0/src/masonite/commands/MakeJobCommand.py +48 -0
- masonite_framework-5.0.0/src/masonite/commands/MakeMailableCommand.py +48 -0
- masonite_framework-5.0.0/src/masonite/commands/MakeMiddlewareCommand.py +53 -0
- masonite_framework-5.0.0/src/masonite/commands/MakePolicyCommand.py +68 -0
- masonite_framework-5.0.0/src/masonite/commands/MakeProviderCommand.py +50 -0
- masonite_framework-5.0.0/src/masonite/commands/MakeTestCommand.py +41 -0
- masonite_framework-5.0.0/src/masonite/commands/MakeViewCommand.py +43 -0
- masonite_framework-5.0.0/src/masonite/commands/PresetCommand.py +48 -0
- masonite_framework-5.0.0/src/masonite/commands/ProjectCommand.py +271 -0
- masonite_framework-5.0.0/src/masonite/commands/PublishPackageCommand.py +44 -0
- masonite_framework-5.0.0/src/masonite/commands/QueueFailedCommand.py +33 -0
- masonite_framework-5.0.0/src/masonite/commands/QueueRetryCommand.py +28 -0
- masonite_framework-5.0.0/src/masonite/commands/QueueTableCommand.py +36 -0
- masonite_framework-5.0.0/src/masonite/commands/QueueWorkCommand.py +31 -0
- masonite_framework-5.0.0/src/masonite/commands/ServeCommand.py +73 -0
- masonite_framework-5.0.0/src/masonite/commands/TinkerCommand.py +103 -0
- masonite_framework-5.0.0/src/masonite/commands/UpCommand.py +15 -0
- masonite_framework-5.0.0/src/masonite/commands/__init__.py +23 -0
- masonite_framework-5.0.0/src/masonite/configuration/Configuration.py +80 -0
- masonite_framework-5.0.0/src/masonite/configuration/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/configuration/helpers.py +5 -0
- masonite_framework-5.0.0/src/masonite/configuration/providers/ConfigurationProvider.py +16 -0
- masonite_framework-5.0.0/src/masonite/configuration/providers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/container/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/container/container.py +494 -0
- masonite_framework-5.0.0/src/masonite/controllers/Controller.py +5 -0
- masonite_framework-5.0.0/src/masonite/controllers/RedirectController.py +10 -0
- masonite_framework-5.0.0/src/masonite/controllers/ViewController.py +10 -0
- masonite_framework-5.0.0/src/masonite/controllers/__init__.py +3 -0
- masonite_framework-5.0.0/src/masonite/cookies/Cookie.py +47 -0
- masonite_framework-5.0.0/src/masonite/cookies/CookieJar.py +83 -0
- masonite_framework-5.0.0/src/masonite/cookies/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/cors/Cors.py +166 -0
- masonite_framework-5.0.0/src/masonite/cors/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/drivers/BaseDriver.py +16 -0
- masonite_framework-5.0.0/src/masonite/drivers/queue/AMQPDriver.py +185 -0
- masonite_framework-5.0.0/src/masonite/drivers/queue/AsyncDriver.py +76 -0
- masonite_framework-5.0.0/src/masonite/drivers/queue/DatabaseDriver.py +208 -0
- masonite_framework-5.0.0/src/masonite/drivers/queue/__init__.py +3 -0
- masonite_framework-5.0.0/src/masonite/drivers/session/CookieDriver.py +63 -0
- masonite_framework-5.0.0/src/masonite/drivers/session/RedisDriver.py +157 -0
- masonite_framework-5.0.0/src/masonite/drivers/session/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/dumps/Dump.py +90 -0
- masonite_framework-5.0.0/src/masonite/dumps/Dumper.py +80 -0
- masonite_framework-5.0.0/src/masonite/dumps/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/environment/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/environment/environment.py +74 -0
- masonite_framework-5.0.0/src/masonite/events/Event.py +81 -0
- masonite_framework-5.0.0/src/masonite/events/Listener.py +2 -0
- masonite_framework-5.0.0/src/masonite/events/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/events/commands/MakeEventCommand.py +39 -0
- masonite_framework-5.0.0/src/masonite/events/commands/MakeListenerCommand.py +38 -0
- masonite_framework-5.0.0/src/masonite/events/commands/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/events/providers/EventProvider.py +18 -0
- masonite_framework-5.0.0/src/masonite/events/providers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/exceptions/DD.py +38 -0
- masonite_framework-5.0.0/src/masonite/exceptions/ExceptionHandler.py +76 -0
- masonite_framework-5.0.0/src/masonite/exceptions/__init__.py +38 -0
- masonite_framework-5.0.0/src/masonite/exceptions/exceptionite/__init__.py +0 -0
- masonite_framework-5.0.0/src/masonite/exceptions/exceptionite/blocks.py +101 -0
- masonite_framework-5.0.0/src/masonite/exceptions/exceptionite/controllers.py +13 -0
- masonite_framework-5.0.0/src/masonite/exceptions/exceptionite/solutions.py +66 -0
- masonite_framework-5.0.0/src/masonite/exceptions/exceptionite/tabs.py +19 -0
- masonite_framework-5.0.0/src/masonite/exceptions/exceptions.py +218 -0
- masonite_framework-5.0.0/src/masonite/exceptions/handlers/DumpExceptionHandler.py +104 -0
- masonite_framework-5.0.0/src/masonite/exceptions/handlers/HttpExceptionHandler.py +28 -0
- masonite_framework-5.0.0/src/masonite/exceptions/handlers/ModelNotFoundHandler.py +13 -0
- masonite_framework-5.0.0/src/masonite/facades/Auth.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Auth.pyi +32 -0
- masonite_framework-5.0.0/src/masonite/facades/Broadcast.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Cache.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Config.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Config.pyi +14 -0
- masonite_framework-5.0.0/src/masonite/facades/Dump.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Dump.pyi +26 -0
- masonite_framework-5.0.0/src/masonite/facades/Facade.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Gate.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Gate.pyi +32 -0
- masonite_framework-5.0.0/src/masonite/facades/Hash.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Hash.pyi +28 -0
- masonite_framework-5.0.0/src/masonite/facades/Loader.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Loader.pyi +30 -0
- masonite_framework-5.0.0/src/masonite/facades/Log.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Log.pyi +24 -0
- masonite_framework-5.0.0/src/masonite/facades/Mail.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Mail.pyi +14 -0
- masonite_framework-5.0.0/src/masonite/facades/Notification.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Notification.pyi +25 -0
- masonite_framework-5.0.0/src/masonite/facades/Queue.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Queue.pyi +10 -0
- masonite_framework-5.0.0/src/masonite/facades/RateLimiter.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/RateLimiter.pyi +43 -0
- masonite_framework-5.0.0/src/masonite/facades/Request.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Request.pyi +88 -0
- masonite_framework-5.0.0/src/masonite/facades/Response.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Response.pyi +68 -0
- masonite_framework-5.0.0/src/masonite/facades/Session.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Session.pyi +59 -0
- masonite_framework-5.0.0/src/masonite/facades/Storage.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Storage.pyi +12 -0
- masonite_framework-5.0.0/src/masonite/facades/Url.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/Url.pyi +22 -0
- masonite_framework-5.0.0/src/masonite/facades/View.py +5 -0
- masonite_framework-5.0.0/src/masonite/facades/View.pyi +54 -0
- masonite_framework-5.0.0/src/masonite/facades/__init__.py +20 -0
- masonite_framework-5.0.0/src/masonite/filesystem/File.py +30 -0
- masonite_framework-5.0.0/src/masonite/filesystem/FileStream.py +18 -0
- masonite_framework-5.0.0/src/masonite/filesystem/Storage.py +38 -0
- masonite_framework-5.0.0/src/masonite/filesystem/UploadedFile.py +36 -0
- masonite_framework-5.0.0/src/masonite/filesystem/__init__.py +3 -0
- masonite_framework-5.0.0/src/masonite/filesystem/drivers/AmazonS3Driver.py +163 -0
- masonite_framework-5.0.0/src/masonite/filesystem/drivers/LocalDriver.py +123 -0
- masonite_framework-5.0.0/src/masonite/filesystem/drivers/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/filesystem/providers/StorageProvider.py +20 -0
- masonite_framework-5.0.0/src/masonite/filesystem/providers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/foundation/Application.py +100 -0
- masonite_framework-5.0.0/src/masonite/foundation/Kernel.py +100 -0
- masonite_framework-5.0.0/src/masonite/foundation/__init__.py +3 -0
- masonite_framework-5.0.0/src/masonite/foundation/response_handler.py +109 -0
- masonite_framework-5.0.0/src/masonite/hashid/helpers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/hashid/helpers/hashid.py +34 -0
- masonite_framework-5.0.0/src/masonite/hashid/middleware/HashIDMiddleware.py +15 -0
- masonite_framework-5.0.0/src/masonite/hashid/middleware/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/hashid/providers/HashIDProvider.py +13 -0
- masonite_framework-5.0.0/src/masonite/hashing/Hash.py +56 -0
- masonite_framework-5.0.0/src/masonite/hashing/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/hashing/drivers/Argon2Hasher.py +37 -0
- masonite_framework-5.0.0/src/masonite/hashing/drivers/BcryptHasher.py +31 -0
- masonite_framework-5.0.0/src/masonite/hashing/drivers/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/headers/Header.py +4 -0
- masonite_framework-5.0.0/src/masonite/headers/HeaderBag.py +58 -0
- masonite_framework-5.0.0/src/masonite/headers/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/helpers/__init__.py +5 -0
- masonite_framework-5.0.0/src/masonite/helpers/compact.py +30 -0
- masonite_framework-5.0.0/src/masonite/helpers/mix.py +34 -0
- masonite_framework-5.0.0/src/masonite/helpers/optional.py +43 -0
- masonite_framework-5.0.0/src/masonite/helpers/urls.py +69 -0
- masonite_framework-5.0.0/src/masonite/input/Input.py +4 -0
- masonite_framework-5.0.0/src/masonite/input/InputBag.py +231 -0
- masonite_framework-5.0.0/src/masonite/input/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/loader/Loader.py +78 -0
- masonite_framework-5.0.0/src/masonite/loader/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/logging/Logger.py +129 -0
- masonite_framework-5.0.0/src/masonite/logging/LoggerExceptionsListener.py +26 -0
- masonite_framework-5.0.0/src/masonite/logging/LoggerFactory.py +51 -0
- masonite_framework-5.0.0/src/masonite/logging/LoggingProvider.py +34 -0
- masonite_framework-5.0.0/src/masonite/logging/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/logging/drivers/BaseDriver.py +82 -0
- masonite_framework-5.0.0/src/masonite/logging/drivers/DailyFileDriver.py +33 -0
- masonite_framework-5.0.0/src/masonite/logging/drivers/SingleFileDriver.py +25 -0
- masonite_framework-5.0.0/src/masonite/logging/drivers/SlackDriver.py +133 -0
- masonite_framework-5.0.0/src/masonite/logging/drivers/StackDriver.py +12 -0
- masonite_framework-5.0.0/src/masonite/logging/drivers/SysLogDriver.py +29 -0
- masonite_framework-5.0.0/src/masonite/logging/drivers/TerminalDriver.py +52 -0
- masonite_framework-5.0.0/src/masonite/logging/drivers/__init__.py +6 -0
- masonite_framework-5.0.0/src/masonite/mail/Mail.py +37 -0
- masonite_framework-5.0.0/src/masonite/mail/Mailable.py +108 -0
- masonite_framework-5.0.0/src/masonite/mail/MessageAttachment.py +4 -0
- masonite_framework-5.0.0/src/masonite/mail/MockMail.py +125 -0
- masonite_framework-5.0.0/src/masonite/mail/Recipient.py +18 -0
- masonite_framework-5.0.0/src/masonite/mail/__init__.py +3 -0
- masonite_framework-5.0.0/src/masonite/mail/drivers/MailgunDriver.py +62 -0
- masonite_framework-5.0.0/src/masonite/mail/drivers/SMTPDriver.py +80 -0
- masonite_framework-5.0.0/src/masonite/mail/drivers/TerminalDriver.py +33 -0
- masonite_framework-5.0.0/src/masonite/mail/drivers/__init__.py +3 -0
- masonite_framework-5.0.0/src/masonite/middleware/__init__.py +15 -0
- masonite_framework-5.0.0/src/masonite/middleware/middleware.py +2 -0
- masonite_framework-5.0.0/src/masonite/middleware/middleware_capsule.py +73 -0
- masonite_framework-5.0.0/src/masonite/middleware/route/ClearDumpsBetweenRequestsMiddleware.py +12 -0
- masonite_framework-5.0.0/src/masonite/middleware/route/CorsMiddleware.py +49 -0
- masonite_framework-5.0.0/src/masonite/middleware/route/EncryptCookies.py +27 -0
- masonite_framework-5.0.0/src/masonite/middleware/route/GuardMiddleware.py +11 -0
- masonite_framework-5.0.0/src/masonite/middleware/route/IpMiddleware.py +35 -0
- masonite_framework-5.0.0/src/masonite/middleware/route/LoadUserMiddleware.py +11 -0
- masonite_framework-5.0.0/src/masonite/middleware/route/MaintenanceModeMiddleware.py +16 -0
- masonite_framework-5.0.0/src/masonite/middleware/route/SessionMiddleware.py +54 -0
- masonite_framework-5.0.0/src/masonite/middleware/route/ShareErrorsInSessionMiddleware.py +19 -0
- masonite_framework-5.0.0/src/masonite/middleware/route/ThrottleRequestsMiddleware.py +64 -0
- masonite_framework-5.0.0/src/masonite/middleware/route/VerifyCsrfToken.py +69 -0
- masonite_framework-5.0.0/src/masonite/middleware/route/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/notification/AnonymousNotifiable.py +39 -0
- masonite_framework-5.0.0/src/masonite/notification/DatabaseNotification.py +38 -0
- masonite_framework-5.0.0/src/masonite/notification/MockNotification.py +120 -0
- masonite_framework-5.0.0/src/masonite/notification/Notifiable.py +68 -0
- masonite_framework-5.0.0/src/masonite/notification/Notification.py +39 -0
- masonite_framework-5.0.0/src/masonite/notification/NotificationManager.py +84 -0
- masonite_framework-5.0.0/src/masonite/notification/SlackMessage.py +166 -0
- masonite_framework-5.0.0/src/masonite/notification/Sms.py +54 -0
- masonite_framework-5.0.0/src/masonite/notification/Textable.py +6 -0
- masonite_framework-5.0.0/src/masonite/notification/__init__.py +9 -0
- masonite_framework-5.0.0/src/masonite/notification/commands/MakeNotificationCommand.py +47 -0
- masonite_framework-5.0.0/src/masonite/notification/commands/NotificationTableCommand.py +37 -0
- masonite_framework-5.0.0/src/masonite/notification/commands/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/notification/drivers/BaseDriver.py +19 -0
- masonite_framework-5.0.0/src/masonite/notification/drivers/BroadcastDriver.py +22 -0
- masonite_framework-5.0.0/src/masonite/notification/drivers/DatabaseDriver.py +37 -0
- masonite_framework-5.0.0/src/masonite/notification/drivers/MailDriver.py +21 -0
- masonite_framework-5.0.0/src/masonite/notification/drivers/SlackDriver.py +110 -0
- masonite_framework-5.0.0/src/masonite/notification/drivers/__init__.py +5 -0
- masonite_framework-5.0.0/src/masonite/notification/drivers/vonage/VonageDriver.py +81 -0
- masonite_framework-5.0.0/src/masonite/notification/providers/NotificationProvider.py +41 -0
- masonite_framework-5.0.0/src/masonite/notification/providers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/orm/commands/DbShellCommand.py +13 -0
- masonite_framework-5.0.0/src/masonite/orm/commands/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/orm/providers/InternalORMProvider.py +48 -0
- masonite_framework-5.0.0/src/masonite/orm/providers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/packages/Package.py +68 -0
- masonite_framework-5.0.0/src/masonite/packages/PublishableResource.py +14 -0
- masonite_framework-5.0.0/src/masonite/packages/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/packages/providers/PackageProvider.py +200 -0
- masonite_framework-5.0.0/src/masonite/packages/providers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/packages/reserved_names.py +1 -0
- masonite_framework-5.0.0/src/masonite/pipeline/Pipeline.py +13 -0
- masonite_framework-5.0.0/src/masonite/pipeline/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/pipeline/tasks/MiddlewareTask.py +0 -0
- masonite_framework-5.0.0/src/masonite/pipeline/tasks/ResponseTask.py +7 -0
- masonite_framework-5.0.0/src/masonite/presets/Bootstrap.py +38 -0
- masonite_framework-5.0.0/src/masonite/presets/Preset.py +75 -0
- masonite_framework-5.0.0/src/masonite/presets/PresetsCapsule.py +16 -0
- masonite_framework-5.0.0/src/masonite/presets/React.py +60 -0
- masonite_framework-5.0.0/src/masonite/presets/Remove.py +50 -0
- masonite_framework-5.0.0/src/masonite/presets/Tailwind.py +37 -0
- masonite_framework-5.0.0/src/masonite/presets/Vue.py +51 -0
- masonite_framework-5.0.0/src/masonite/presets/__init__.py +6 -0
- masonite_framework-5.0.0/src/masonite/presets/providers/PresetsProvider.py +25 -0
- masonite_framework-5.0.0/src/masonite/presets/providers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/providers/AuthenticationProvider.py +18 -0
- masonite_framework-5.0.0/src/masonite/providers/AuthorizationProvider.py +13 -0
- masonite_framework-5.0.0/src/masonite/providers/CacheProvider.py +19 -0
- masonite_framework-5.0.0/src/masonite/providers/ExceptionProvider.py +86 -0
- masonite_framework-5.0.0/src/masonite/providers/FrameworkProvider.py +53 -0
- masonite_framework-5.0.0/src/masonite/providers/HashServiceProvider.py +20 -0
- masonite_framework-5.0.0/src/masonite/providers/HelpersProvider.py +38 -0
- masonite_framework-5.0.0/src/masonite/providers/MailProvider.py +25 -0
- masonite_framework-5.0.0/src/masonite/providers/Provider.py +15 -0
- masonite_framework-5.0.0/src/masonite/providers/QueueProvider.py +18 -0
- masonite_framework-5.0.0/src/masonite/providers/RouteProvider.py +73 -0
- masonite_framework-5.0.0/src/masonite/providers/SessionProvider.py +20 -0
- masonite_framework-5.0.0/src/masonite/providers/ViewProvider.py +35 -0
- masonite_framework-5.0.0/src/masonite/providers/WhitenoiseProvider.py +26 -0
- masonite_framework-5.0.0/src/masonite/providers/__init__.py +24 -0
- masonite_framework-5.0.0/src/masonite/queues/Queue.py +45 -0
- masonite_framework-5.0.0/src/masonite/queues/Queueable.py +25 -0
- masonite_framework-5.0.0/src/masonite/queues/ShouldQueue.py +2 -0
- masonite_framework-5.0.0/src/masonite/queues/__init__.py +3 -0
- masonite_framework-5.0.0/src/masonite/rates/Limit.py +39 -0
- masonite_framework-5.0.0/src/masonite/rates/RateLimiter.py +91 -0
- masonite_framework-5.0.0/src/masonite/rates/__init__.py +3 -0
- masonite_framework-5.0.0/src/masonite/rates/limiters.py +41 -0
- masonite_framework-5.0.0/src/masonite/rates/providers/RateProvider.py +14 -0
- masonite_framework-5.0.0/src/masonite/rates/providers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/request/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/request/request.py +184 -0
- masonite_framework-5.0.0/src/masonite/request/validation.py +14 -0
- masonite_framework-5.0.0/src/masonite/response/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/response/response.py +252 -0
- masonite_framework-5.0.0/src/masonite/routes/HTTPRoute.py +399 -0
- masonite_framework-5.0.0/src/masonite/routes/Route.py +242 -0
- masonite_framework-5.0.0/src/masonite/routes/Router.py +136 -0
- masonite_framework-5.0.0/src/masonite/routes/__init__.py +3 -0
- masonite_framework-5.0.0/src/masonite/routes/commands/RouteListCommand.py +67 -0
- masonite_framework-5.0.0/src/masonite/routes/commands/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/scheduling/CanSchedule.py +10 -0
- masonite_framework-5.0.0/src/masonite/scheduling/CommandTask.py +13 -0
- masonite_framework-5.0.0/src/masonite/scheduling/Task.py +148 -0
- masonite_framework-5.0.0/src/masonite/scheduling/TaskHandler.py +30 -0
- masonite_framework-5.0.0/src/masonite/scheduling/__init__.py +4 -0
- masonite_framework-5.0.0/src/masonite/scheduling/commands/MakeTaskCommand.py +47 -0
- masonite_framework-5.0.0/src/masonite/scheduling/commands/ScheduleRunCommand.py +20 -0
- masonite_framework-5.0.0/src/masonite/scheduling/commands/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/scheduling/providers/ScheduleProvider.py +20 -0
- masonite_framework-5.0.0/src/masonite/scheduling/providers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/sessions/Session.py +180 -0
- masonite_framework-5.0.0/src/masonite/sessions/__init__.py +2 -0
- masonite_framework-5.0.0/src/masonite/sessions/helpers.py +6 -0
- masonite_framework-5.0.0/src/masonite/storage/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/storage/storage.py +10 -0
- masonite_framework-5.0.0/src/masonite/stubs/auth/mailables/ResetPassword.py +15 -0
- masonite_framework-5.0.0/src/masonite/stubs/commands/Command.py +20 -0
- masonite_framework-5.0.0/src/masonite/stubs/controllers/APIController.py +19 -0
- masonite_framework-5.0.0/src/masonite/stubs/controllers/Controller.py +7 -0
- masonite_framework-5.0.0/src/masonite/stubs/controllers/ResourceController.py +25 -0
- masonite_framework-5.0.0/src/masonite/stubs/controllers/auth/HomeController.py +7 -0
- masonite_framework-5.0.0/src/masonite/stubs/controllers/auth/LoginController.py +25 -0
- masonite_framework-5.0.0/src/masonite/stubs/controllers/auth/PasswordResetController.py +40 -0
- masonite_framework-5.0.0/src/masonite/stubs/controllers/auth/RegisterController.py +31 -0
- masonite_framework-5.0.0/src/masonite/stubs/events/Event.py +2 -0
- masonite_framework-5.0.0/src/masonite/stubs/events/Listener.py +3 -0
- masonite_framework-5.0.0/src/masonite/stubs/jobs/Job.py +6 -0
- masonite_framework-5.0.0/src/masonite/stubs/mailable/Mailable.py +12 -0
- masonite_framework-5.0.0/src/masonite/stubs/middlewares/Middleware.py +9 -0
- masonite_framework-5.0.0/src/masonite/stubs/notification/Notification.py +15 -0
- masonite_framework-5.0.0/src/masonite/stubs/notification/create_notifications_table.py +17 -0
- masonite_framework-5.0.0/src/masonite/stubs/policies/ModelPolicy.py +24 -0
- masonite_framework-5.0.0/src/masonite/stubs/policies/Policy.py +6 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/base/app.css +1 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/base/app.js +2 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/base/bootstrap.js +23 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/base/package.json +17 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/base/webpack.mix.js +23 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/bootstrap/_variables.scss +19 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/bootstrap/app.scss +13 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/bootstrap/webpack.mix.js +21 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/react/Example.js +22 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/react/app.html +21 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/react/app.js +15 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/react/webpack.mix.js +22 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/tailwind/app.css +3 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/tailwind/tailwind.config.js +11 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/tailwind/webpack.mix.js +23 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/vue/App.vue +26 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/vue/HelloWorld.vue +35 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/vue/app.html +21 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/vue/app.js +46 -0
- masonite_framework-5.0.0/src/masonite/stubs/presets/vue/webpack.mix.js +22 -0
- masonite_framework-5.0.0/src/masonite/stubs/providers/Provider.py +12 -0
- masonite_framework-5.0.0/src/masonite/stubs/queue/create_failed_jobs_table.py +20 -0
- masonite_framework-5.0.0/src/masonite/stubs/queue/create_queue_jobs_table.py +20 -0
- masonite_framework-5.0.0/src/masonite/stubs/scheduling/Task.py +7 -0
- masonite_framework-5.0.0/src/masonite/stubs/templates/auth/base.html +13 -0
- masonite_framework-5.0.0/src/masonite/stubs/templates/auth/change_password.html +77 -0
- masonite_framework-5.0.0/src/masonite/stubs/templates/auth/home.html +17 -0
- masonite_framework-5.0.0/src/masonite/stubs/templates/auth/login.html +78 -0
- masonite_framework-5.0.0/src/masonite/stubs/templates/auth/mailables/reset_password.html +31 -0
- masonite_framework-5.0.0/src/masonite/stubs/templates/auth/password_reset.html +68 -0
- masonite_framework-5.0.0/src/masonite/stubs/templates/auth/register.html +85 -0
- masonite_framework-5.0.0/src/masonite/stubs/templates/view.html +16 -0
- masonite_framework-5.0.0/src/masonite/stubs/tests/TestCase.py +9 -0
- masonite_framework-5.0.0/src/masonite/stubs/validation/Rule.py +48 -0
- masonite_framework-5.0.0/src/masonite/stubs/validation/RuleEnclosure.py +18 -0
- masonite_framework-5.0.0/src/masonite/templates/__init__.py +0 -0
- masonite_framework-5.0.0/src/masonite/templates/assets/github-dark.min.css +10 -0
- masonite_framework-5.0.0/src/masonite/templates/assets/highlight.min.js +384 -0
- masonite_framework-5.0.0/src/masonite/templates/assets/tailwind.css +1 -0
- masonite_framework-5.0.0/src/masonite/templates/dump.html +93 -0
- masonite_framework-5.0.0/src/masonite/tests/DatabaseTransactions.py +8 -0
- masonite_framework-5.0.0/src/masonite/tests/HttpTestResponse.py +374 -0
- masonite_framework-5.0.0/src/masonite/tests/MockInput.py +6 -0
- masonite_framework-5.0.0/src/masonite/tests/TestCase.py +493 -0
- masonite_framework-5.0.0/src/masonite/tests/TestCommand.py +65 -0
- masonite_framework-5.0.0/src/masonite/tests/TestResponseCapsule.py +17 -0
- masonite_framework-5.0.0/src/masonite/tests/__init__.py +4 -0
- masonite_framework-5.0.0/src/masonite/utils/__init__.py +0 -0
- masonite_framework-5.0.0/src/masonite/utils/collections.py +545 -0
- masonite_framework-5.0.0/src/masonite/utils/console.py +39 -0
- masonite_framework-5.0.0/src/masonite/utils/data/mime.types +1863 -0
- masonite_framework-5.0.0/src/masonite/utils/filesystem.py +100 -0
- masonite_framework-5.0.0/src/masonite/utils/http.py +101 -0
- masonite_framework-5.0.0/src/masonite/utils/location.py +90 -0
- masonite_framework-5.0.0/src/masonite/utils/str.py +120 -0
- masonite_framework-5.0.0/src/masonite/utils/structures.py +127 -0
- masonite_framework-5.0.0/src/masonite/utils/time.py +58 -0
- masonite_framework-5.0.0/src/masonite/validation/MessageBag.py +123 -0
- masonite_framework-5.0.0/src/masonite/validation/RuleEnclosure.py +2 -0
- masonite_framework-5.0.0/src/masonite/validation/Validator.py +1578 -0
- masonite_framework-5.0.0/src/masonite/validation/__init__.py +52 -0
- masonite_framework-5.0.0/src/masonite/validation/commands/MakeRuleCommand.py +48 -0
- masonite_framework-5.0.0/src/masonite/validation/commands/MakeRuleEnclosureCommand.py +49 -0
- masonite_framework-5.0.0/src/masonite/validation/commands/__init__.py +0 -0
- masonite_framework-5.0.0/src/masonite/validation/decorators.py +20 -0
- masonite_framework-5.0.0/src/masonite/validation/providers/ValidationProvider.py +23 -0
- masonite_framework-5.0.0/src/masonite/validation/providers/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/validation/resources/postal_codes.py +1011 -0
- masonite_framework-5.0.0/src/masonite/views/ViewCapsule.py +0 -0
- masonite_framework-5.0.0/src/masonite/views/__init__.py +1 -0
- masonite_framework-5.0.0/src/masonite/views/view.py +255 -0
- masonite_framework-5.0.0/src/masonite_framework.egg-info/PKG-INFO +146 -0
- masonite_framework-5.0.0/src/masonite_framework.egg-info/SOURCES.txt +438 -0
- masonite_framework-5.0.0/src/masonite_framework.egg-info/dependency_links.txt +1 -0
- masonite_framework-5.0.0/src/masonite_framework.egg-info/entry_points.txt +2 -0
- masonite_framework-5.0.0/src/masonite_framework.egg-info/requires.txt +46 -0
- masonite_framework-5.0.0/src/masonite_framework.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Masonite X Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
include src/masonite/stubs/auth/mailables/*
|
|
2
|
+
include src/masonite/stubs/commands/*
|
|
3
|
+
include src/masonite/stubs/controllers/*
|
|
4
|
+
include src/masonite/stubs/controllers/auth/*
|
|
5
|
+
include src/masonite/stubs/events/*
|
|
6
|
+
include src/masonite/stubs/jobs/*
|
|
7
|
+
include src/masonite/stubs/mailable/*
|
|
8
|
+
include src/masonite/stubs/middlewares/*
|
|
9
|
+
include src/masonite/stubs/notification/*
|
|
10
|
+
include src/masonite/stubs/policies/*
|
|
11
|
+
include src/masonite/stubs/presets/base/*
|
|
12
|
+
include src/masonite/stubs/presets/tailwind/*
|
|
13
|
+
include src/masonite/stubs/presets/vue/*
|
|
14
|
+
include src/masonite/stubs/presets/react/*
|
|
15
|
+
include src/masonite/stubs/presets/bootstrap/*
|
|
16
|
+
include src/masonite/stubs/providers/*
|
|
17
|
+
include src/masonite/stubs/queue/*
|
|
18
|
+
include src/masonite/stubs/scheduling/*
|
|
19
|
+
include src/masonite/stubs/scheduling/templates/auth/*
|
|
20
|
+
include src/masonite/stubs/templates/*
|
|
21
|
+
include src/masonite/stubs/templates/auth/*
|
|
22
|
+
include src/masonite/stubs/templates/auth/mailables/*
|
|
23
|
+
include src/masonite/stubs/tests/*
|
|
24
|
+
include src/masonite/stubs/validation/*
|
|
25
|
+
include src/masonite/utils/data/*
|
|
26
|
+
include src/masonite/validation/snippets/*
|
|
27
|
+
include src/masonite/templates/*
|
|
28
|
+
include src/masonite/templates/assets/*
|
|
29
|
+
include src/masonite/api/stubs/*
|
|
30
|
+
include src/masonite/api/stubs/routes/*
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: masonite-framework
|
|
3
|
+
Version: 5.0.0
|
|
4
|
+
Summary: Masonite is a modern and developer centric Python web framework.
|
|
5
|
+
Author: Joe Mancuso
|
|
6
|
+
Maintainer-email: Eduardo Aguad <contact@masonite.dev>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/masonitedev/masonite
|
|
9
|
+
Project-URL: Documentation, https://github.com/masonitedev/masonite
|
|
10
|
+
Project-URL: Source, https://github.com/masonitedev/masonite
|
|
11
|
+
Keywords: Masonite,masonite-framework,Python,Web Framework
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
15
|
+
Classifier: Environment :: Web Environment
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: inflection<0.6,>=0.5
|
|
27
|
+
Requires-Dist: exceptionite<4,>=3
|
|
28
|
+
Requires-Dist: pendulum[test]<4,>=3
|
|
29
|
+
Requires-Dist: jinja2<4,>=3.1
|
|
30
|
+
Requires-Dist: cleo<0.9,>=0.8.1
|
|
31
|
+
Requires-Dist: hupper<2,>=1.12
|
|
32
|
+
Requires-Dist: bcrypt<6,>=4
|
|
33
|
+
Requires-Dist: whitenoise<7,>=6.6
|
|
34
|
+
Requires-Dist: python-dotenv<2,>=1
|
|
35
|
+
Requires-Dist: masonite-orm<4,>=3
|
|
36
|
+
Requires-Dist: hashids<2,>=1.3
|
|
37
|
+
Requires-Dist: cryptography<46,>=42
|
|
38
|
+
Requires-Dist: tldextract<6,>=5
|
|
39
|
+
Requires-Dist: hfilesize>=0.1
|
|
40
|
+
Requires-Dist: dotty_dict<2,>=1.3
|
|
41
|
+
Requires-Dist: pyjwt<3,>=2.8
|
|
42
|
+
Requires-Dist: pytest<9,>=8
|
|
43
|
+
Requires-Dist: werkzeug<4,>=3
|
|
44
|
+
Requires-Dist: watchdog<7,>=4
|
|
45
|
+
Requires-Dist: multipart<2,>=1.2
|
|
46
|
+
Requires-Dist: requests<3,>=2.28
|
|
47
|
+
Provides-Extra: test
|
|
48
|
+
Requires-Dist: coverage; extra == "test"
|
|
49
|
+
Requires-Dist: redis; extra == "test"
|
|
50
|
+
Requires-Dist: boto3; extra == "test"
|
|
51
|
+
Requires-Dist: pusher; extra == "test"
|
|
52
|
+
Requires-Dist: pymemcache; extra == "test"
|
|
53
|
+
Requires-Dist: vonage<4,>=3.16; extra == "test"
|
|
54
|
+
Requires-Dist: slackblocks<2,>=1; extra == "test"
|
|
55
|
+
Requires-Dist: argon2-cffi<26,>=23; extra == "test"
|
|
56
|
+
Requires-Dist: pwnedapi<2,>=1; extra == "test"
|
|
57
|
+
Requires-Dist: responses<1,>=0.25; extra == "test"
|
|
58
|
+
Requires-Dist: phonenumbers<10,>=8.12; extra == "test"
|
|
59
|
+
Provides-Extra: vonage
|
|
60
|
+
Requires-Dist: vonage<4,>=3.16; extra == "vonage"
|
|
61
|
+
Requires-Dist: phonenumbers<10,>=8.12; extra == "vonage"
|
|
62
|
+
Provides-Extra: argon2
|
|
63
|
+
Requires-Dist: argon2-cffi<26,>=23; extra == "argon2"
|
|
64
|
+
Provides-Extra: dev
|
|
65
|
+
Requires-Dist: flake8; extra == "dev"
|
|
66
|
+
Requires-Dist: black; extra == "dev"
|
|
67
|
+
Requires-Dist: isort; extra == "dev"
|
|
68
|
+
Dynamic: license-file
|
|
69
|
+
|
|
70
|
+
<p align="center">
|
|
71
|
+
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4trhpkkdbbzutc5ufxi9.png" width="160px">
|
|
72
|
+
<h1 align="center">Masonite</h1>
|
|
73
|
+
</p>
|
|
74
|
+
<p align="center">
|
|
75
|
+
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/masonitedev/masonite/pythonapp.yml">
|
|
76
|
+
|
|
77
|
+
<img alt="GitHub release (latest by date including pre-releases)" src="https://img.shields.io/github/v/release/masonitedev/masonite?include_prereleases">
|
|
78
|
+
<img src="https://img.shields.io/github/license/masonitedev/masonite.svg" alt="License">
|
|
79
|
+
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
|
|
80
|
+
</p>
|
|
81
|
+
|
|
82
|
+
## About Masonite
|
|
83
|
+
|
|
84
|
+
Stop using old frameworks with just a few confusing features. Masonite is the developer focused dev tool with all the features you need for the rapid development you deserve. Masonite is perfect for beginners getting their first web app deployed or advanced developers and businesses that need to reach for the full fleet of features available. A short list of the available features are:
|
|
85
|
+
|
|
86
|
+
* Mail support for sending emails quickly.
|
|
87
|
+
* Queue support to speed your application up by sending jobs to run on a queue or asynchronously.
|
|
88
|
+
* Notifications for sending notifications to your users simply and effectively.
|
|
89
|
+
* Task scheduling to run your jobs on a schedule (like everyday at midnight) so you can set and forget your tasks.
|
|
90
|
+
* Events you can listen for to execute listeners that perform your tasks when certain events happen in your app.
|
|
91
|
+
* A BEAUTIFUL Active Record style ORM called Masonite ORM. Amazingness at your fingertips.
|
|
92
|
+
* Many more features you need which you can find in the docs!
|
|
93
|
+
|
|
94
|
+
## Learning Masonite
|
|
95
|
+
|
|
96
|
+
New to Masonite? Check out the [official repository](https://github.com/masonitedev/masonite).
|
|
97
|
+
Masonite strives to have extremely clear documentation 😃. It would be wise to go through the tutorials there.
|
|
98
|
+
If you find any discrepencies or anything that doesn't make sense, please open an issue and we will get it cleared up!
|
|
99
|
+
|
|
100
|
+
## Getting Started Quickly
|
|
101
|
+
|
|
102
|
+
Create and activate a virtual environment and if you have a working Python 3.10–3.13 installation then getting started is as quick as typing
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pip install masonite-framework
|
|
106
|
+
project start .
|
|
107
|
+
python craft serve
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Upgrading from 4.x to 5.0
|
|
111
|
+
|
|
112
|
+
Masonite has moved to the [masonitedev](https://github.com/masonitedev) organization and the PyPI package has been renamed from `masonite` to `masonite-framework`.
|
|
113
|
+
|
|
114
|
+
1. Uninstall the old package and install the new one:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pip uninstall masonite
|
|
118
|
+
pip install "masonite-framework>=5,<6"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
2. Imports are unchanged — you still `import masonite` / `from masonite import ...`.
|
|
122
|
+
3. Python 3.10–3.13 is now required (3.8/3.9 were dropped as they reached end of life).
|
|
123
|
+
4. Masonite ORM 3.x and Pendulum 3.x are now required. If your app parses dates directly with Pendulum, review the [Pendulum 3 changes](https://pendulum.eustace.io/blog/announcing-pendulum-3-0-0.html) (parsing is stricter).
|
|
124
|
+
5. New in 5.0: a full logging system with `terminal`, `single`, `daily`, `stack`, `syslog` and `slack` drivers, configured in `config/logging.py` and available through the `Log` facade. Unhandled exceptions are logged automatically with their traceback.
|
|
125
|
+
6. The repository now lives at https://github.com/masonitedev/masonite — update your remotes, issues and links.
|
|
126
|
+
|
|
127
|
+
## Contributing
|
|
128
|
+
|
|
129
|
+
Contributing to Masonite is simple:
|
|
130
|
+
|
|
131
|
+
- Read the [Contributing Guide](https://github.com/masonitedev/masonite/blob/5.0/CONTRIBUTING.md) to learn how to contribute to the core source code development of the project.
|
|
132
|
+
- Open an [issue](https://github.com/masonitedev/masonite/issues) or a [pull request](https://github.com/masonitedev/masonite/pulls) to ask questions, report bugs or propose changes.
|
|
133
|
+
|
|
134
|
+
## Core Maintainers
|
|
135
|
+
|
|
136
|
+
- [Joseph Mancuso](https://github.com/josephmancuso) (Author)
|
|
137
|
+
- [Samuel Girardin](https://github.com/girardinsamuel)
|
|
138
|
+
- [Marlysson Silva](https://github.com/Marlysson)
|
|
139
|
+
|
|
140
|
+
## Security Vulnerabilities
|
|
141
|
+
|
|
142
|
+
If you discover a security vulnerability within Masonite please read the [Security Policy](./SECURITY.md). All security vulnerabilities will be promptly addressed.
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
The Masonite framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4trhpkkdbbzutc5ufxi9.png" width="160px">
|
|
3
|
+
<h1 align="center">Masonite</h1>
|
|
4
|
+
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/masonitedev/masonite/pythonapp.yml">
|
|
7
|
+
|
|
8
|
+
<img alt="GitHub release (latest by date including pre-releases)" src="https://img.shields.io/github/v/release/masonitedev/masonite?include_prereleases">
|
|
9
|
+
<img src="https://img.shields.io/github/license/masonitedev/masonite.svg" alt="License">
|
|
10
|
+
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
## About Masonite
|
|
14
|
+
|
|
15
|
+
Stop using old frameworks with just a few confusing features. Masonite is the developer focused dev tool with all the features you need for the rapid development you deserve. Masonite is perfect for beginners getting their first web app deployed or advanced developers and businesses that need to reach for the full fleet of features available. A short list of the available features are:
|
|
16
|
+
|
|
17
|
+
* Mail support for sending emails quickly.
|
|
18
|
+
* Queue support to speed your application up by sending jobs to run on a queue or asynchronously.
|
|
19
|
+
* Notifications for sending notifications to your users simply and effectively.
|
|
20
|
+
* Task scheduling to run your jobs on a schedule (like everyday at midnight) so you can set and forget your tasks.
|
|
21
|
+
* Events you can listen for to execute listeners that perform your tasks when certain events happen in your app.
|
|
22
|
+
* A BEAUTIFUL Active Record style ORM called Masonite ORM. Amazingness at your fingertips.
|
|
23
|
+
* Many more features you need which you can find in the docs!
|
|
24
|
+
|
|
25
|
+
## Learning Masonite
|
|
26
|
+
|
|
27
|
+
New to Masonite? Check out the [official repository](https://github.com/masonitedev/masonite).
|
|
28
|
+
Masonite strives to have extremely clear documentation 😃. It would be wise to go through the tutorials there.
|
|
29
|
+
If you find any discrepencies or anything that doesn't make sense, please open an issue and we will get it cleared up!
|
|
30
|
+
|
|
31
|
+
## Getting Started Quickly
|
|
32
|
+
|
|
33
|
+
Create and activate a virtual environment and if you have a working Python 3.10–3.13 installation then getting started is as quick as typing
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install masonite-framework
|
|
37
|
+
project start .
|
|
38
|
+
python craft serve
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Upgrading from 4.x to 5.0
|
|
42
|
+
|
|
43
|
+
Masonite has moved to the [masonitedev](https://github.com/masonitedev) organization and the PyPI package has been renamed from `masonite` to `masonite-framework`.
|
|
44
|
+
|
|
45
|
+
1. Uninstall the old package and install the new one:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip uninstall masonite
|
|
49
|
+
pip install "masonite-framework>=5,<6"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
2. Imports are unchanged — you still `import masonite` / `from masonite import ...`.
|
|
53
|
+
3. Python 3.10–3.13 is now required (3.8/3.9 were dropped as they reached end of life).
|
|
54
|
+
4. Masonite ORM 3.x and Pendulum 3.x are now required. If your app parses dates directly with Pendulum, review the [Pendulum 3 changes](https://pendulum.eustace.io/blog/announcing-pendulum-3-0-0.html) (parsing is stricter).
|
|
55
|
+
5. New in 5.0: a full logging system with `terminal`, `single`, `daily`, `stack`, `syslog` and `slack` drivers, configured in `config/logging.py` and available through the `Log` facade. Unhandled exceptions are logged automatically with their traceback.
|
|
56
|
+
6. The repository now lives at https://github.com/masonitedev/masonite — update your remotes, issues and links.
|
|
57
|
+
|
|
58
|
+
## Contributing
|
|
59
|
+
|
|
60
|
+
Contributing to Masonite is simple:
|
|
61
|
+
|
|
62
|
+
- Read the [Contributing Guide](https://github.com/masonitedev/masonite/blob/5.0/CONTRIBUTING.md) to learn how to contribute to the core source code development of the project.
|
|
63
|
+
- Open an [issue](https://github.com/masonitedev/masonite/issues) or a [pull request](https://github.com/masonitedev/masonite/pulls) to ask questions, report bugs or propose changes.
|
|
64
|
+
|
|
65
|
+
## Core Maintainers
|
|
66
|
+
|
|
67
|
+
- [Joseph Mancuso](https://github.com/josephmancuso) (Author)
|
|
68
|
+
- [Samuel Girardin](https://github.com/girardinsamuel)
|
|
69
|
+
- [Marlysson Silva](https://github.com/Marlysson)
|
|
70
|
+
|
|
71
|
+
## Security Vulnerabilities
|
|
72
|
+
|
|
73
|
+
If you discover a security vulnerability within Masonite please read the [Security Policy](./SECURITY.md). All security vulnerabilities will be promptly addressed.
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
The Masonite framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "masonite-framework"
|
|
7
|
+
description = "Masonite is a modern and developer centric Python web framework."
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
license = { text = "MIT" }
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
authors = [{ name = "Joe Mancuso" }]
|
|
12
|
+
maintainers = [{ name = "Eduardo Aguad", email = "contact@masonite.dev" }]
|
|
13
|
+
keywords = ["Masonite", "masonite-framework", "Python", "Web Framework"]
|
|
14
|
+
dynamic = ["version"]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"inflection>=0.5,<0.6",
|
|
17
|
+
"exceptionite>=3,<4",
|
|
18
|
+
"pendulum[test]>=3,<4",
|
|
19
|
+
"jinja2>=3.1,<4",
|
|
20
|
+
"cleo>=0.8.1,<0.9",
|
|
21
|
+
"hupper>=1.12,<2",
|
|
22
|
+
"bcrypt>=4,<6",
|
|
23
|
+
"whitenoise>=6.6,<7",
|
|
24
|
+
"python-dotenv>=1,<2",
|
|
25
|
+
"masonite-orm>=3,<4",
|
|
26
|
+
"hashids>=1.3,<2",
|
|
27
|
+
"cryptography>=42,<46",
|
|
28
|
+
"tldextract>=5,<6",
|
|
29
|
+
"hfilesize>=0.1",
|
|
30
|
+
"dotty_dict>=1.3,<2",
|
|
31
|
+
"pyjwt>=2.8,<3",
|
|
32
|
+
"pytest>=8,<9",
|
|
33
|
+
"werkzeug>=3,<4",
|
|
34
|
+
"watchdog>=4,<7",
|
|
35
|
+
"multipart>=1.2,<2",
|
|
36
|
+
"requests>=2.28,<3",
|
|
37
|
+
]
|
|
38
|
+
classifiers = [
|
|
39
|
+
"Development Status :: 5 - Production/Stable",
|
|
40
|
+
"Intended Audience :: Developers",
|
|
41
|
+
"Topic :: Software Development :: Build Tools",
|
|
42
|
+
"Environment :: Web Environment",
|
|
43
|
+
"License :: OSI Approved :: MIT License",
|
|
44
|
+
"Operating System :: OS Independent",
|
|
45
|
+
"Programming Language :: Python :: 3.10",
|
|
46
|
+
"Programming Language :: Python :: 3.11",
|
|
47
|
+
"Programming Language :: Python :: 3.12",
|
|
48
|
+
"Programming Language :: Python :: 3.13",
|
|
49
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[project.urls]
|
|
53
|
+
Homepage = "https://github.com/masonitedev/masonite"
|
|
54
|
+
Documentation = "https://github.com/masonitedev/masonite"
|
|
55
|
+
Source = "https://github.com/masonitedev/masonite"
|
|
56
|
+
|
|
57
|
+
[project.optional-dependencies]
|
|
58
|
+
test = [
|
|
59
|
+
"coverage",
|
|
60
|
+
"redis",
|
|
61
|
+
"boto3",
|
|
62
|
+
"pusher",
|
|
63
|
+
"pymemcache",
|
|
64
|
+
"vonage>=3.16,<4",
|
|
65
|
+
"slackblocks>=1,<2",
|
|
66
|
+
"argon2-cffi>=23,<26",
|
|
67
|
+
"pwnedapi>=1,<2",
|
|
68
|
+
"responses>=0.25,<1",
|
|
69
|
+
"phonenumbers>=8.12,<10",
|
|
70
|
+
]
|
|
71
|
+
vonage = ["vonage>=3.16,<4", "phonenumbers>=8.12,<10"]
|
|
72
|
+
argon2 = ["argon2-cffi>=23,<26"]
|
|
73
|
+
dev = ["flake8", "black", "isort"]
|
|
74
|
+
|
|
75
|
+
[project.scripts]
|
|
76
|
+
project = "masonite.commands.Entry:application.run"
|
|
77
|
+
|
|
78
|
+
[tool.setuptools]
|
|
79
|
+
include-package-data = true
|
|
80
|
+
|
|
81
|
+
[tool.setuptools.dynamic]
|
|
82
|
+
version = { attr = "masonite.__version__" }
|
|
83
|
+
|
|
84
|
+
[tool.setuptools.packages.find]
|
|
85
|
+
where = ["src"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "5.0.0"
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import jwt
|
|
2
|
+
import pendulum
|
|
3
|
+
from ..routes import Route
|
|
4
|
+
from .controllers import AuthenticationController
|
|
5
|
+
from ..utils.str import random_string
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Api:
|
|
9
|
+
def __init__(self, application, driver_config=None):
|
|
10
|
+
self.application = application
|
|
11
|
+
|
|
12
|
+
def set_configuration(self, config):
|
|
13
|
+
self.config = config
|
|
14
|
+
return self
|
|
15
|
+
|
|
16
|
+
def generate_token(self):
|
|
17
|
+
secret = self.config.get("jwt").get("secret")
|
|
18
|
+
algorithm = self.config.get("jwt").get("algorithm")
|
|
19
|
+
expire_minutes = self.config.get("jwt").get("expires")
|
|
20
|
+
version = self.config.get("jwt").get("version")
|
|
21
|
+
if expire_minutes:
|
|
22
|
+
expire_minutes = (
|
|
23
|
+
pendulum.now(tz="UTC").add(minutes=expire_minutes).to_datetime_string()
|
|
24
|
+
)
|
|
25
|
+
token = jwt.encode(
|
|
26
|
+
{"expires": expire_minutes, "version": version, "random": random_string(10)}, secret, algorithm=algorithm
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
return token
|
|
30
|
+
|
|
31
|
+
def get_token(self):
|
|
32
|
+
request = self.application.make("request")
|
|
33
|
+
token = request.input("token")
|
|
34
|
+
|
|
35
|
+
if token:
|
|
36
|
+
return token
|
|
37
|
+
|
|
38
|
+
header = request.header("Authorization")
|
|
39
|
+
|
|
40
|
+
if header:
|
|
41
|
+
return header.replace("Bearer ", "")
|
|
42
|
+
|
|
43
|
+
def validate_token(self, token):
|
|
44
|
+
secret = self.config.get("jwt").get("secret")
|
|
45
|
+
algorithm = self.config.get("jwt").get("algorithm")
|
|
46
|
+
expire_minutes = self.config.get("jwt").get("expires")
|
|
47
|
+
authenticates = self.config.get("jwt").get("authenticates")
|
|
48
|
+
version = self.config.get("jwt").get("version")
|
|
49
|
+
if expire_minutes:
|
|
50
|
+
expire_minutes = (
|
|
51
|
+
pendulum.now(tz="UTC").add(minutes=expire_minutes).to_datetime_string()
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
unencrypted_token = jwt.decode(token, secret, algorithms=[algorithm])
|
|
56
|
+
except (jwt.InvalidSignatureError, jwt.DecodeError):
|
|
57
|
+
return False
|
|
58
|
+
expires = unencrypted_token.get("expires")
|
|
59
|
+
|
|
60
|
+
if version:
|
|
61
|
+
if unencrypted_token["version"] != version:
|
|
62
|
+
return False
|
|
63
|
+
|
|
64
|
+
if authenticates:
|
|
65
|
+
return self.attempt_by_token(token)
|
|
66
|
+
|
|
67
|
+
if not expires:
|
|
68
|
+
return True
|
|
69
|
+
|
|
70
|
+
expired = pendulum.parse(expires, tz="UTC").is_past()
|
|
71
|
+
|
|
72
|
+
if expired:
|
|
73
|
+
return False
|
|
74
|
+
|
|
75
|
+
return True
|
|
76
|
+
|
|
77
|
+
def regenerate_token(self, token):
|
|
78
|
+
# if the token can be decoded, regenerate new token
|
|
79
|
+
secret = self.config.get("jwt").get("secret")
|
|
80
|
+
algorithm = self.config.get("jwt").get("algorithm")
|
|
81
|
+
try:
|
|
82
|
+
jwt.decode(token, secret, algorithms=[algorithm])
|
|
83
|
+
return self.generate_token()
|
|
84
|
+
except jwt.DecodeError:
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
return False
|
|
88
|
+
|
|
89
|
+
def attempt_by_token(self, token):
|
|
90
|
+
model = self.config.get("jwt").get("model")()
|
|
91
|
+
return model.attempt_by_token(token)
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
def routes(cls, auth_route="/api/auth", reauth_route="/api/reauth"):
|
|
95
|
+
return [
|
|
96
|
+
Route.post("/api/auth", AuthenticationController.auth),
|
|
97
|
+
Route.post("/api/reauth", AuthenticationController.reauth),
|
|
98
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .Api import Api
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from ..facades import Api
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AuthenticatesTokens:
|
|
5
|
+
|
|
6
|
+
__TOKEN_COLUMN__ = "api_token"
|
|
7
|
+
|
|
8
|
+
def generate_jwt(self):
|
|
9
|
+
token = Api.generate_token()
|
|
10
|
+
|
|
11
|
+
setattr(self, self.__TOKEN_COLUMN__, token)
|
|
12
|
+
self.save()
|
|
13
|
+
return token
|
|
14
|
+
|
|
15
|
+
def attempt_by_token(self, token):
|
|
16
|
+
return self.where(self.__TOKEN_COLUMN__, token).first()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .AuthenticatesTokens import AuthenticatesTokens
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Scaffold Auth Command."""
|
|
2
|
+
import os
|
|
3
|
+
from ...utils.filesystem import render_stub_file, get_module_dir
|
|
4
|
+
from ...utils.location import config_path
|
|
5
|
+
from ...utils.str import random_string
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
from ...commands.Command import Command
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class APIInstallCommand(Command):
|
|
12
|
+
"""
|
|
13
|
+
Adds required files for building API's
|
|
14
|
+
|
|
15
|
+
api:install
|
|
16
|
+
{--f|force=? : Force overriding file if already exists}
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def __init__(self, application):
|
|
20
|
+
super().__init__()
|
|
21
|
+
self.app = application
|
|
22
|
+
|
|
23
|
+
def handle(self):
|
|
24
|
+
stub_path = self.get_stub_config_path()
|
|
25
|
+
|
|
26
|
+
content = render_stub_file(stub_path, "api.py")
|
|
27
|
+
|
|
28
|
+
path = config_path("api.py")
|
|
29
|
+
if os.path.exists(path) and not self.option("force"):
|
|
30
|
+
self.warning(
|
|
31
|
+
f"{path} already exists! Run the command with -f (force) to override."
|
|
32
|
+
)
|
|
33
|
+
return -1
|
|
34
|
+
|
|
35
|
+
with open(path, "w") as f:
|
|
36
|
+
f.write(content)
|
|
37
|
+
|
|
38
|
+
if os.path.exists(path) and not self.option("force"):
|
|
39
|
+
self.warning(
|
|
40
|
+
f"{path} already exists! Run the command with -f (force) to override."
|
|
41
|
+
)
|
|
42
|
+
return -1
|
|
43
|
+
|
|
44
|
+
with open(path, "w") as f:
|
|
45
|
+
f.write(content)
|
|
46
|
+
|
|
47
|
+
secret = random_string(25)
|
|
48
|
+
|
|
49
|
+
self.info(f"API Installed: ({config_path('api.py', absolute=False)})")
|
|
50
|
+
self.info(
|
|
51
|
+
f"JWT Secret Key Is: {secret}. You should store this in an environment variable called JWT_SECRET."
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
def get_stub_config_path(self):
|
|
55
|
+
return os.path.join(get_module_dir(__file__), "../stubs/api.py")
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from ...controllers import Controller
|
|
2
|
+
from ...request import Request
|
|
3
|
+
from ...response import Response
|
|
4
|
+
from ...authentication import Auth
|
|
5
|
+
from ..facades import Api
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AuthenticationController(Controller):
|
|
9
|
+
def auth(self, auth: Auth, request: Request, response: Response):
|
|
10
|
+
user = auth.attempt(request.input("username"), request.input("password"))
|
|
11
|
+
|
|
12
|
+
if user:
|
|
13
|
+
return {"data": user.generate_jwt()}
|
|
14
|
+
|
|
15
|
+
return response.json(
|
|
16
|
+
{"message": "Could not find username or password"}, status="403"
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
def reauth(self, request: Request, response: Response):
|
|
20
|
+
user = Api.attempt_by_token(request.input("token"))
|
|
21
|
+
|
|
22
|
+
if user:
|
|
23
|
+
return {"data": user.generate_jwt()}
|
|
24
|
+
|
|
25
|
+
return response.json(
|
|
26
|
+
{"message": "Could not reauthenticate based on given token."}, status="403"
|
|
27
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .AuthenticationController import AuthenticationController
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .Api import Api
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from ..facades import Api
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class JWTGuard:
|
|
5
|
+
def __init__(self, application):
|
|
6
|
+
self.application = application
|
|
7
|
+
self.connection = None
|
|
8
|
+
|
|
9
|
+
def set_options(self, options):
|
|
10
|
+
self.options = options
|
|
11
|
+
return self
|
|
12
|
+
|
|
13
|
+
def attempt(self, username, password):
|
|
14
|
+
attempt = self.options.get("model")().attempt(username, password)
|
|
15
|
+
if attempt:
|
|
16
|
+
return attempt
|
|
17
|
+
|
|
18
|
+
def get_auth_column(self, username):
|
|
19
|
+
return self.options.get("model")().get_auth_column(username)
|
|
20
|
+
|
|
21
|
+
def register(self, dictionary):
|
|
22
|
+
try:
|
|
23
|
+
register = self.options.get("model")().register(dictionary)
|
|
24
|
+
except Exception:
|
|
25
|
+
return False
|
|
26
|
+
return self.attempt_by_id(register.get_id())
|
|
27
|
+
|
|
28
|
+
def user(self):
|
|
29
|
+
"""Get the currently logged in user.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
object|bool -- Returns the current authenticated user object or False or None if there is none.
|
|
33
|
+
"""
|
|
34
|
+
# token = self.application.make("request").cookie("token")
|
|
35
|
+
token = Api.get_token()
|
|
36
|
+
if token and self.options.get("model")():
|
|
37
|
+
return self.options.get("model")().attempt_by_token(token) or False
|
|
38
|
+
|
|
39
|
+
return False
|
|
40
|
+
|
|
41
|
+
def attempt_by_id(self, user_id):
|
|
42
|
+
"""Login a user by the user ID.
|
|
43
|
+
|
|
44
|
+
Arguments:
|
|
45
|
+
user_id {string|int} -- The ID of the user model record.
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
object|False -- Returns the current authenticated user object or False or None if there is none.
|
|
49
|
+
"""
|
|
50
|
+
attempt = self.options.get("model")().attempt_by_id(user_id)
|
|
51
|
+
|
|
52
|
+
if attempt and not self.options.get("once"):
|
|
53
|
+
self.application.make("request").set_user(attempt)
|
|
54
|
+
return attempt
|
|
55
|
+
|
|
56
|
+
return False
|
|
57
|
+
|
|
58
|
+
def once(self):
|
|
59
|
+
"""Log in the user without saving a cookie.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
self
|
|
63
|
+
"""
|
|
64
|
+
self._once = True
|
|
65
|
+
return self
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .JWTGuard import JWTGuard
|