Don't create all this infrastructure by hand. Instead use DevKit to create a simple wrapper connector around the OAuth2-secured API you want to use.
You will receive OAuth2 support OOTB: http://www.mulesoft.org/documentation/display/current/Implementing+OAuth+2.0+Authentication
Plus you will get a custom element you can use in Studio.