gatt: Check attribute security permissions

This patch introduces the check_attribute_security helper which
checks the encryption and authentication requirements from a given
attribute.

This patch also adds the security checking in Read Request, Read by
Type Request, Write Command and Write Request handlers. There is no
security check in Read by Group Type Request handler since it is
restricted to primary services.