how to use HWIOAuthBundle to get last tweet in symfony2 - symfony

I'm using Symfony2 project,
how can i use HWIOAuthBundle to get last tweet on twitter?
Or, other bundle symfony to authentication api 1.1 of twitter?
please give me a suggestion.

I guess using the HWIOAuthBundle is not the correct choice for fetching tweets over the new API. It's main purpose is to extend the security layer, so you can implement a login system using OAuthTokens.
I recommend you the EndroidTwitterBundle. It's simple, easy and created for your exact use case.

Related

Implementing authentication and authorization using OWIN

I try to create authentication and authorization for my single page web-api project.
For this purpose I red this cool article from Taiseer Joudeh.
But the problem is that in my project I have database with tables and I want to adopt OWIN to work with my existing tables.
Maybe someone knows useful article or post on which I can rely for this subject?
You need to be looking at creating a custom Identity storage provider. Read the following as a starting point: https://www.asp.net/identity/overview/extensibility/overview-of-custom-storage-providers-for-aspnet-identity.

What is the best way to implement LinkedIn Authentication in MVC6 ASP.NET5 web app

There is no LinkedIn-specific library from Microsoft like Microsoft.AspNet.Authentication.Facebook. The third party libraries I tried are designed for ASP.NET4.5.
I also waiting for middleware for LinkedIn authentication from aspnet team, but look like they have no plans to create it - read LinkedIn Authentication and Will we have a Authentication.LinkedIn.
#Tratcher wrote:
No, but there's a comunity implementation available here: aspnet-contrib/AspNet.Security.OAuth.Providers
You can try this one above and please let me know if it's working well, please.
Also You can create middleware yourself based on generic OAuth middleware...
Check aspnet/Security repo on GitHub, and read LinkedIn Authenticating with OAuth 2.0 article.
As Lukasz pointed out, you can use the LinkedIn provider in the https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers project. I wrote that provider and it is just a thin layer on top of the built-in generic OAuth2 provider.
It you want to use the generic OAuth2 provider directly, you can also look at this blog post which takes you step-by-step through the entire process:
https://auth0.com/blog/2016/06/13/authenticating-a-user-with-linkedin-in-aspnet-core/

Symfony2 Forms for API and Web

I have an existing website using a fairly "standard" Symfony full-stack, using the Form component to display and process html forms.
Now, I am creating a REST API to retrieve and manipulate our resources, and I'll use the FOSRestBundle to help with that.
I want to offer nice error messages for the forms, and FOSRestBundle ships a default way to do that. Great.
My question is: should I use the SAME form classes I used in Web? Or should I duplicate all of the forms and start from scratch?
The API will need much of the same validation as Web, but some things like Captcha and CSRF are for sure different.
Thanks for any input on this.
It's a matter of taste.
If you have very different forms then it will be easy to do new form-classes. But if you have almost the same you can use your existing forms.
In one of my projects I had different fields in forms for API and Web but I had one Form class. I just check every time: is it API or Web. And manage fields according to the type of request.

using fosUserBundle's authentication in separate program

I would like to use the hash algorithm from FOSUserBundle in a standalone app.
Here's what I want to do:
-Copy the user table into a standalone app
-Let users use their symfony2 login in my separate app
In order to do this, I need to code a copy of the FOSUserBundles authentication in my app.
So my question is - where can I find this algorithm in the FOSUserBundle codebase? Is it just a md5() together with the user specific salt or how is it constructed?
Thanks!
* UPDATE *
So while this would certainly be interesting to know how to do, I am now faced instead with changing the algorithm in FOSUserBundle, so I will have to do it the other way around. And I will open a different topic for that.
To answer your original question:
Password encoders are part of the Synfony's core, not FOSUserBundle. You may find them in vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder.
To find the correct encoder to use in your custom script look what you have configured for FOSUserBundle.

LDAP integration in Symfony2

I'm new to symfony & LDAP. Is there any step by step tutorial or videos to integrate LDAP in symfony2?
I don't know any tutorial or video about LDAP in Symfony2 but here are 2 bundles I used in many projects:
OpenSkyLdapBundle (requires ZF2 LDAP component)
FR3DLdapBundle (integration with FOSUserBundle)
Newer versions of Symfony2 should have LDAP support already in there. If you are constrained to an older version, consider using DapsBundle, since its functionality is patterned after Symfony2's upgrade path, meaning it should be easier for you when you do upgrade your Symfony2 version.. You can learn more about on my blog at http://robertelwell.info/blog/daps-ldap-symfony2/.
FOSUserBundle is a bundle for authenticate users against a DB, if you don't want manager your users with the DB then you must do a little customizations for break the dependency in FR3DLdapBundle.
Writing your own UserManager and setting it in the configuration should be enough.
The UserManager is used for create the User instance the first time.

Resources