[aerogear-dev] [Android] - Refactoring OAuth2 configuration

Matthias Wessendorf matzew at apache.org
Mon Mar 9 12:20:44 EDT 2015


On Mon, Mar 9, 2015 at 3:00 PM, Erik Jan de Wit <edewit at redhat.com> wrote:

> +1 that would make it more in sync with iOS and Windows, where we created
> profiled config:
>
>
> https://github.com/aerogear/aerogear-windows-oauth2/blob/master/aerogear-windows-oauth2/AccountManager.cs#L86
>
> https://github.com/aerogear/aerogear-ios-oauth2/blob/master/AeroGearOAuth2/AccountManager.swift#L23
>

I think these _are_ good examples of specific configuration options for
different 3rd party services


>
>
>
> On 9 Mar,2015, at 14:42 , Bruno Oliveira <bruno at abstractj.org> wrote:
>
> Good morning, while writing our quickstarts, I found something that I
> would like to change.
>
> Currently to setup our OAuth2 providers we have to do something like
> this:
>
> AuthorizationManager.config(MODULE_NAME,
> OAuth2AuthorizationConfiguration.class)
>        .setBaseURL(new URL("https://"))
>        .setAuthzEndpoint(AUTHZ_ENDPOINT)
>        .setAccessTokenEndpoint(AUTHZ_TOKEN_ENDPOINT)
>        .setAccountId(AUTHZ_ACCOOUNT_ID)
>        .setClientId(AUTHZ_CLIENT_ID)
>        .setClientSecret(AUTHZ_CLIENT_SECRET)
>        .setRedirectURL(AUTHZ_REDIRECT_URL)
>        .setRefreshEndpoint(AUTHZ_TOKEN_ENDPOINT)
>        .addAdditionalAccessParam(Pair.create("response_type", "code"))
>        .setScopes(Arrays.asList("photo_upload, publish_actions"))
>        .asModule();
>
> Although, things like the url endpoint, access token endpoint, or the
> module will most of time remain unchanged. Unless you switch from Facebook
> to
> Keycloak for example. People don't care that much about these
> urls, but which provider they want to connect.
>
> So I would like to refactor the authz module from AGDroid, define the
> default values
> for ommitted params and make the methods like setBaseURL for example,
> alternative. Something like this:
>
> AuthorizationManager.config(MODULE_NAME,
> OAuth2AuthorizationConfiguration.class)
>        .setClientId(AUTHZ_CLIENT_ID)
>        .setClientSecret(AUTHZ_CLIENT_SECRET)
>        .asModule();
>
> Based on the module name, we instantiate the respective module with the
> default values already in.
>
> Thoughts? Let me know if the idea is useless.
>
>
> --
>
> abstractj
> PGP: 0x84DC9914
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>
>
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20150309/d36560d1/attachment-0001.html 


More information about the aerogear-dev mailing list