1000 search results

Finishing the Request

…it's from security! Open that up: Shift+Shift, ContextListener.php. Scroll down to find the method we care about: onKernelResponse(). It says: Writes the security token into the session. If you use a "stateful" firewall... which you probably are, unless your security system is…

6:03
Validating Who/When Can Publish

…probably work! However, I tend to view things like this: security is best when you're trying to completely prevent access to an operation. Validation is best when the restrictions you need to apply are based on the data that's being sent, like preventing…

8:22
Login with json_login

If your login system looks similar to the traditional email & password or username & password setup, Symfony has a nice, built-in authentication mechanism to help. In config/packages/security.yaml, under the main firewall, add a new key: json_login. Below that, set check_path…

6:27
Deny Access in the Controller

There are two main places where you can deny access. The first we just learned about: access_control in security.yaml: It's simple - just a regular expression and a role. It's the best way to protect entire areas of your site - like everything…

3:06
TargetPathTrait: Redirect to Previous Page

…after registering. But... it's not as awesome as it could be. Let me show you why. First, look at my app/config/security.yml file. In order to access any URL that start with /admin, you need to be logged in. For example, if…

3:05
Webhooks: Preventing Replay Attacks

There's one last teeny, tiny little detail we need to worry about with webhooks: replay attacks. These are a security concern but also a practical one. We already know that nobody can send us, random, fake event data because we fetch a fresh event…

5:41
Environments

Question: if config.yml is so important - then what the heck is the point of all of these other files - like config_dev.yml, config_test.yml, parameters.yml, security.yml and services.yml. What is their purpose? The answer is environments. Now, I don…

2:59
The LoginFormAuthenticator

…Guard - no matter what crazy authentication system you have - the first step is always to create an authenticator class. Create a new directory called Security and inside, a new class: how about LoginFormAuthenticator: The only rule about an authenticator is that it needs to extend…

4:45
JWT Guard Authenticator (Part 1)

…The process is easy: we'll walk through each method and just fill in the logic. But if you want to know more - check out the Symfony security course. First: getCredentials(). Our job is to read the Authorization header and return the token - if any…

5:39
Securing More Endpoints

… We have this great system where users are actually being authenticated! Now we can start checking for security everywhere we need it. In newAction we’re requiring that you are logged in: // src/KnpU/CodeBattle/Controller/Api/ProgrammerController.php // ... public function newAction(Request $request) { } Awesome…

3:05
Using PHPDoc for Auto-Completion

…Auto-Completion¶ With the base Controller, we can give ourselves shortcuts to develop faster and faster. Inside RegisterController, my IDE recognizes the setToken method on the security context automatically. Actually, this only works because I’m using an awesome Symfony2 plugin for PHPStorm. The getSecurityContext…

1:26
Denying Access: AccessDeniedException

…s prod environment, we’ll be able to customize how this looks. We’ll cover how to customize error pages in the next episode. The access_control section of security.yml is the easiest way to control access, but also the least flexible. Change the…

4:23
Logging Out and Cleaning Up

…route called event, which is our event list page. Use that for target: # app/config/security.yml # ... firewalls: To make the logout route, let’s add another method inside SecurityController and use the @Route annotation: // ... // src/Yoda/UserBundle/Controller/SecurityController.php /** @Route("/logout", name="logout…

5:03
Creating a Login Form (Part 1)

…actual login form? Well, that’s our job - the security layer just helps us by redirecting the user here. Oh, and there’s a really popular open source bundle called FosUserBundle that gives you a lot of what we’re about to build. The good…

4:46
Describing for Exception Messages

…securities, an exception should be thrown. And of course, we will need to update some of our examples from earlier once we get this working so that they also have some active security. Anyways, down in addDinosaur(), let's call another new method if (!$this…

8:14
Coding a new Feature

…obvious if you put something in the wrong spot. Press Shift+Shift and search for a file that's closely related to our new feature: TargetPathTrait. Ok, this lives in the Security component. I'll double click on the directory to move there. At first…

10:05
Logs, Sessions & File Permissions

…the cache directory. To get our site working, we're setting the entire var/ directory to 777: This includes cache/, logs/ and sessions/. This is a bummer for security. Here's my big question: after we deploy, which files truly need to be writable by…

5:32
API Platform 2 Part 3: Custom Resources

…of the Api Platform series! In part 1, we built a fully-featured API. Then in part 2 we leveled-up by adding a robust security system, security checks and user-specific fields. So what's left? In part 3, we're taking customizations to…

48 videos
|
5:13:28
Starting in Symfony2: Course 2 (2.4+)

Over the next hour, we're going to take you through some of the most difficult areas of Symfony learning all about security, forms, and parts of Doctrine. We'll also see testing and learn more about how Symfony's service container works. When you…

36 videos
|
1:50:44
Understanding Password Hashing

…in Symfony - password migration! In your IDE, open config/packages/security.yaml and check out the password_hashers section. We have a single hasher configured for our PasswordAuthenticatedUserInterface users, and it's set to auto. Does this cover our custom User? Open src/Entity/User…

9:51