Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
android-components
Commits
73881386
Commit
73881386
authored
Apr 08, 2019
by
Vlad Filippov
Committed by
Christian Sadilek
Apr 12, 2019
Browse files
Remove extra success path url for the FxA feature
See also
https://github.com/mozilla/fxa-content-server/pull/7077
parent
0835821a
Changes
3
Hide whitespace changes
Inline
Side-by-side
components/feature/accounts/src/main/java/mozilla/components/feature/accounts/FirefoxAccountsAuthFeature.kt
View file @
73881386
...
...
@@ -23,7 +23,6 @@ class FirefoxAccountsAuthFeature(
private
val
accountManager
:
FxaAccountManager
,
private
val
tabsUseCases
:
TabsUseCases
,
private
val
redirectUrl
:
String
,
private
val
successPath
:
String
,
private
val
coroutineContext
:
CoroutineContext
=
Dispatchers
.
Main
)
{
fun
beginAuthentication
()
{
...
...
@@ -59,20 +58,21 @@ class FirefoxAccountsAuthFeature(
val
interceptor
=
object
:
RequestInterceptor
{
override
fun
onLoadRequest
(
session
:
EngineSession
,
uri
:
String
):
RequestInterceptor
.
InterceptionResponse
?
{
if
(!
uri
.
startsWith
(
redirectUrl
))
{
return
null
}
if
(
uri
.
startsWith
(
redirectUrl
))
{
val
parsedUri
=
Uri
.
parse
(
uri
)
val
code
=
parsedUri
.
getQueryParameter
(
"code"
)
if
(
code
!=
null
)
{
val
state
=
parsedUri
.
getQueryParameter
(
"state"
)
as
String
val
parsedUri
=
Uri
.
parse
(
uri
)
val
code
=
parsedUri
.
getQueryParameter
(
"code"
)
as
String
val
state
=
parsedUri
.
getQueryParameter
(
"state"
)
as
String
// Notify the state machine about our success.
accountManager
.
finishAuthenticationAsync
(
code
,
state
)
// Notify the state machine about our success.
accountManager
.
finishAuthenticationAsync
(
code
,
state
)
return
RequestInterceptor
.
InterceptionResponse
.
Url
(
redirectUrl
)
}
}
// TODO this can be simplified once https://github.com/mozilla/application-services/issues/305 lands
val
successUrl
=
"${parsedUri.scheme}://${parsedUri.host}/$successPath"
return
RequestInterceptor
.
InterceptionResponse
.
Url
(
successUrl
)
return
null
}
}
}
components/feature/accounts/src/test/java/mozilla/components/feature/accounts/FirefoxAccountsAuthFeatureTest.kt
View file @
73881386
...
...
@@ -55,7 +55,7 @@ class FirefoxAccountsAuthFeatureTest {
`when`
(
mockTabs
.
addTab
).
thenReturn
(
mockAddTab
)
runBlocking
{
val
feature
=
FirefoxAccountsAuthFeature
(
manager
,
mockTabs
,
"somePath"
,
"somePath"
,
this
.
coroutineContext
)
val
feature
=
FirefoxAccountsAuthFeature
(
manager
,
mockTabs
,
"somePath"
,
this
.
coroutineContext
)
feature
.
beginAuthentication
()
}
...
...
@@ -70,7 +70,7 @@ class FirefoxAccountsAuthFeatureTest {
`when`
(
mockTabs
.
addTab
).
thenReturn
(
mockAddTab
)
runBlocking
{
val
feature
=
FirefoxAccountsAuthFeature
(
manager
,
mockTabs
,
"somePath"
,
"somePath"
,
this
.
coroutineContext
)
val
feature
=
FirefoxAccountsAuthFeature
(
manager
,
mockTabs
,
"somePath"
,
this
.
coroutineContext
)
feature
.
beginPairingAuthentication
(
"auth://pair"
)
}
...
...
@@ -85,7 +85,7 @@ class FirefoxAccountsAuthFeatureTest {
`when`
(
mockTabs
.
addTab
).
thenReturn
(
mockAddTab
)
runBlocking
{
val
feature
=
FirefoxAccountsAuthFeature
(
manager
,
mockTabs
,
"somePath"
,
"somePath"
,
this
.
coroutineContext
)
val
feature
=
FirefoxAccountsAuthFeature
(
manager
,
mockTabs
,
"somePath"
,
this
.
coroutineContext
)
feature
.
beginAuthentication
()
}
...
...
@@ -101,7 +101,7 @@ class FirefoxAccountsAuthFeatureTest {
`when`
(
mockTabs
.
addTab
).
thenReturn
(
mockAddTab
)
runBlocking
{
val
feature
=
FirefoxAccountsAuthFeature
(
manager
,
mockTabs
,
"somePath"
,
"somePath"
,
this
.
coroutineContext
)
val
feature
=
FirefoxAccountsAuthFeature
(
manager
,
mockTabs
,
"somePath"
,
this
.
coroutineContext
)
feature
.
beginPairingAuthentication
(
"auth://pair"
)
}
...
...
docs/changelog.md
View file @
73881386
...
...
@@ -44,6 +44,9 @@ permalink: /changelog/
*
Adds
`automaticLanguageAdjustment`
setting, which should hint to implementations to send
language specific headers to websites. Implementation in
`browser-engine-gecko-nightly`
.
*
**service-firefox-accounts**
*
The service no longer accepts a
`successPath`
option. Instead the service uses the OAuth
`redirectUri`
.
# 0.49.0
*
[
Commits
](
https://github.com/mozilla-mobile/android-components/compare/v0.48.0...v0.49.0
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment