Serializer Error Renderer: JSON/XML Errors
…If you wanted
to change this data, you could do that by adding your own custom normalizer.
We actually talk about this in our
API Platform Security Tutorial.
You could decorate the ProblemNormalizer... and maybe just add or tweak some
data or you could create…
phpunit-bridge & routing Recipes
…we didn't care about - is in .env.test.
Revert it with:
git checkout .env.test
Woo! Let's find out what recipes we have left:
composer recipes
Woh! Only 3 main Symfony repositories left: security-bundle, translation
and validator. Let's do those next.
Coding the API Upload Endpoint
…forget to put security back: @IsGranted("MANAGE", subject="article").
In a real project, wherever I test my API endpoints - like Postman or via functional
tests, I would actually authenticate myself properly so they worked, instead of
temporarily hacking out security. Generally speaking, removing security is…
The ObjectStateMatcher
…inside Enclosure. Remove all this complicated stuff and, at the end, just say:
|| $dinosaur->hasSameDietAs($this->dinosaurs[0]).
Run phpspec one more time:
Got it! Next, let's talk a bit more about testing exceptions and finally add
some Security to our dino park.
Autocomplete JavaScript
…until now, if we've wanted to add a class attribute, we've done it from inside
of our Twig template. For example, open security/register.html.twig. For the form
start tag, we're passing an attr variable with a class key. Or, for…
Redirecting on Success & the User Provider
…that info is loaded from the session and we're
logged in. Cool!
Look back at your security.yaml file. Remember this user provider thing that was
setup for us?
This is a class that helps with the process of loading the user info from…
Composer & Cache Permissions
…to directory, mode to 0777 and recurse: true:
On deploy, this will make sure that the directory exists and is set to 777. That's not
the best option for security... but it should get things working!
Deploy one more time:
Type beefpass, deploy to…
Load Balancer & Reverse Proxy Setup
…needs to be smart enough to read these headers, instead
of the normal ones. Symfony doesn't do this automatically, because it could be a
security risk. You need to configure it explicitly.
Google for "Symfony reverse proxy". Ok! In our front controller - so app…
Deploying Keys & Private Repos
… Why did I do this? Mostly, simplicity! Thanks
to this, the private key will always exist.
How bad of a security issue is this? Well, this key only gives you read-only access
to the repository. And, if you were already able to download the…
CSRF Protection Part 2
…by requiring this header to always be set, we give our application a bit
more security: it removes the possibility that's somebody could create a CSRF
attack on that endpoint... or some future endpoint that we don't send any data to.
In other…
Launch a Cloud Instance!
…using the module is pretty simple! We're just going to give it a lot
of info about the image we want, the security group to use, the region and so on.
Add a new task called "Create an Instance". Use the ec2 module and…
ReactJS talks to your API
…sweet
JavaScript. And we're just starting to scratch the surface of Symfony.
What about talking to a database, using forms, setting up security or handling API
input and validation? How and why should you register your own services? And what
are event listeners? The…
Requiring Authentication
…re throwing an exception! But bad news,
our exception is the one weird guy in the whole system: instead of being
handled here, it’s handled somewhere else entirely.
ApiEntryPoint: Where Security Responses are Created¶
Without getting too far into things, I’ve already written…
Implicit Grant Type with Google+
…Code grant type and redirecting the user,
we only really need to worry about the JavaScript origins. Google makes us
fill these in for security purposes - a topic we'll cover later.
When we're finished, we have a brand new Client ID and secret…
User API Resource
…eventually store the encoded password, which
is not something that an API client will set directly. But... we're going to
worry about all of that in our security tutorial. For now, because password is a
required field in the database, let's temporarily make…
Relating Resources
…is no different than setting any other field. Later, once we have a real
security system, we'll start locking things down so that I can't create a
CheeseListing and say that someone else owns it.
Anyways, to make owner part of our API…
Operations
…we'll learn about other, API-Platform-specific stuff
that you can put here, like access_control for security and ways to control the
serialization process.
In fact, let's learn about that process right now! How does API Platform transform
our CheeseListing object - with…
Completely Custom Field via a Data Provider
…this in the browser. Go to /api/users.jsonld.
And... oh! If you get "full authentication is required", that's our security
system in action! Go team! In another tab, I'll go back to my homepage and hit
log in. Refresh the original tab…
Custom Item Data Provider
…for this is to also make sure that we set this field in the data persister.
At the top, add one more argument - Security $security - and then initialize that
property:
Below, in persist() - we could add the logic in the if statement where we know…
x
1000+