Setting OAuthAppSettings configuration parameters from provider

6 views
Skip to first unread message

Alex Soto

unread,
Jul 3, 2014, 6:31:55 AM7/3/14
to agora...@googlegroups.com
Agorava supports to set OAuthAppSettings (API_KEY and API_SECRET) from annotation and from a file called agorava.properties. Probably also from system properties and so on because I think it uses deltaspike under covers to deal with properties files. But what's happen if I store this information in a database? Is there a way to create an OAuthAppSettings from a parameters provider or should I create manually the OAuthAppSettings object?

Thank you so much,

Alex.

Antoine Sabot-Durand

unread,
Jul 3, 2014, 9:52:47 AM7/3/14
to agora...@googlegroups.com
Hi Alex,

Thanks for your question. You have 2 solutions for your need.

1) if you have to do this once you can create your own OAuthSettings and produces it with the right Service qualifier like this

@ApplicationScoped
@Twitter
@Produces
public OAuthAppsettings producesTwitterSettings() {
OAuthAppsettings mySettings;
//Do your JPA stuff here to build the OAuthAppSettings,

return mySettings;
}

2) If you want a reusable solution, you can implements the OAuthAppsettingsBuilder to create a JpaOauthAppsettingsBuilder.
When it’s done you can use it your producer method or let Agorava extension do the job for you by using @OAuthApplication annotation:

@ApplicationScoped
@Twitter
@Produces
@OAuthApplication(builder = OAuthAppSettingsBuilder.class,params = {@Param(name = "pu", value = "myPersisitenceUnit")})
public OAuthAppSettings produceSettings;

Params are optional in the annotation off course.



Antoine Sabot-Durand
———————————————
Twitter : @antoine_sd
CDI co-spec lead & eco-system development
Agorava tech lead

--
You received this message because you are subscribed to the Google Groups "Agorava Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to agorava-dev...@googlegroups.com.
To post to this group, send email to agora...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/agorava-dev/c3239aa3-1650-4425-8184-3d9b4a2f49cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc

Alex Soto

unread,
Jul 4, 2014, 4:47:14 AM7/4/14
to agora...@googlegroups.com
Thank you so much, the first approach was what I was thinking to fix it.

Thanks for your support,
Alex.
--
+----------------------------------------------------------+
  Alex Soto Bueno - Computer Engineer
  www.lordofthejars.com
+----------------------------------------------------------+
Reply all
Reply to author
Forward
0 new messages