Handling Authentication Tokens in Single Page Apps

There are broad scenarios in which a single page app (SPA) needs to handle authentication: The SPA is using an API custom built for the app itself -- the API being used is not public in any other way The SPA is using an API built for public consumption -- one with a full fledged… Continue reading Handling Authentication Tokens in Single Page Apps

Working with Multiple Content-Security-Policy Headers

Working with Multiple CSP Headers

Today I've been fighting with Content Security Policy (CSP). Servers may send multiple CSP headers, but there is a catch: Adding additional policies can only further restrict the capabilities of the protected resource I had wrongly assumed that I could pretty up my nginx configuration by splitting up the various *-src directives into separate add_header… Continue reading Working with Multiple Content-Security-Policy Headers

Making Multiple Instances Play Nice with Symfony’s Autowiring

Autowiring & Multiple Instances

Symfony's autowiring is one of the best things to come to the framework in the 3.X series. Without it we would all still be extending ContainerAware base classes and be using a service locator. But what if we need multiple instances of somethign in the container? The docs talk about dealing with multiple implementations of… Continue reading Making Multiple Instances Play Nice with Symfony’s Autowiring

Improving Symfony ChoiceType Error Messages

Symfony Choice Type Error Messages

The Symfony ChoiceType is a complex, interesting beast. By far my biggest complaint about it is the error messages shown to the user during validation are not great. Defaulting to, "This value is not valid," with no help for the user on what values are actually allowed. That's okay for plain HTML interfaces where the… Continue reading Improving Symfony ChoiceType Error Messages