Files
firefox/mobile/android/base/sync/net/AbstractBearerTokenAuthHeaderProvider.java
T
Nick Alexander 37667fb441 Bug 1117829 - Add Firefox Account-backed oauth client. r=rnewman
The oauth client exchanges Firefox Account assertions for oauth token
grants.  The client_id is assumed to have the "canGrant" capability on
the oauth endpoint.

========

https://github.com/mozilla-services/android-sync/commit/d1a25c8233240a5a1c03de5394c2be92819779c2
Author: Nick Alexander <[email protected]>
    Bug 1117829 - Part 3: Add FxA oauth and profile clients.

========

https://github.com/mozilla-services/android-sync/commit/6c52ce9b53c3ef2ec34ddf7410fdfa8501925948
Author: Nick Alexander <[email protected]>
Date:   Mon Aug 18 13:53:56 2014 -0700

    Bug 1117829 - Part 2: Support remote verifier v1 and v2.

========

https://github.com/mozilla-services/android-sync/commit/679e972d2cf98be26778be4e88972ebd285ec511
Author: Nick Alexander <[email protected]>
Date:   Mon Aug 18 11:52:45 2014 -0700

    Bug 1117829 - Part 1: Generalize bearer token auth header providers.

========

https://github.com/mozilla-services/android-sync/commit/b55a14fe889b6d13d7603d9d202dd9f67e9add0e
Author: Nick Alexander <[email protected]>
Date:   Mon Aug 18 13:54:46 2014 -0700

    Bug 1117829 - Pre: Add static methods for cross-class testing.

========

https://github.com/mozilla-services/android-sync/commit/5576662dd3528a53c5a9549619c7d31ed7a4860a
Author: Nick Alexander <[email protected]>
Date:   Mon Aug 18 11:42:45 2014 -0700

    Bug 1117829 - Pre: Fix debug printing of JWT structures.
2014-08-18 14:07:57 -07:00

35 lines
1.2 KiB
Java

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.sync.net;
import ch.boye.httpclientandroidlib.Header;
import ch.boye.httpclientandroidlib.client.methods.HttpRequestBase;
import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient;
import ch.boye.httpclientandroidlib.message.BasicHeader;
import ch.boye.httpclientandroidlib.protocol.BasicHttpContext;
/**
* An <code>AuthHeaderProvider</code> that returns an Authorization header for
* bearer tokens, adding a simple prefix.
*/
public abstract class AbstractBearerTokenAuthHeaderProvider implements AuthHeaderProvider {
protected final String header;
public AbstractBearerTokenAuthHeaderProvider(String token) {
if (token == null) {
throw new IllegalArgumentException("token must not be null.");
}
this.header = getPrefix() + " " + token;
}
protected abstract String getPrefix();
@Override
public Header getAuthHeader(HttpRequestBase request, BasicHttpContext context, DefaultHttpClient client) {
return new BasicHeader("Authorization", header);
}
}