-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/bma/OIDC session end #8620
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8f6edba
Fix typo
bmarty 12395e9
OIDC redirect to the web page to delete a session (legacy session man…
bmarty 4254415
Format
bmarty 8941e63
Hide multi signout if we have an external account manager (#8616)
bmarty 880ed69
OIDC redirect to the web page to delete a session (new session manage…
bmarty dc19380
Changelog
bmarty a889d8d
Store the authentication issuer into DB.
bmarty 52a0693
Change the test to hide multi signout of devices.
bmarty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
If an external account manager is configured on the server, use it to delete other sessions and hide the multi session deletion. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,8 +290,8 @@ class VectorSettingsDevicesFragment : | |
val unverifiedSessionsCount = deviceFullInfoList?.unverifiedSessionsCount ?: 0 | ||
|
||
renderSecurityRecommendations(inactiveSessionsCount, unverifiedSessionsCount) | ||
renderCurrentSessionView(currentDeviceInfo, hasOtherDevices = otherDevices?.isNotEmpty().orFalse()) | ||
renderOtherSessionsView(otherDevices, state.isShowingIpAddress) | ||
renderCurrentSessionView(currentDeviceInfo, hasOtherDevices = otherDevices?.isNotEmpty().orFalse(), state) | ||
renderOtherSessionsView(otherDevices, state) | ||
} else { | ||
hideSecurityRecommendations() | ||
hideCurrentSessionView() | ||
|
@@ -347,13 +347,16 @@ class VectorSettingsDevicesFragment : | |
hideInactiveSessionsRecommendation() | ||
} | ||
|
||
private fun renderOtherSessionsView(otherDevices: List<DeviceFullInfo>?, isShowingIpAddress: Boolean) { | ||
private fun renderOtherSessionsView(otherDevices: List<DeviceFullInfo>?, state: DevicesViewState) { | ||
val isShowingIpAddress = state.isShowingIpAddress | ||
if (otherDevices.isNullOrEmpty()) { | ||
hideOtherSessionsView() | ||
} else { | ||
views.deviceListHeaderOtherSessions.isVisible = true | ||
val colorDestructive = colorProvider.getColorFromAttribute(R.attr.colorError) | ||
val multiSignoutItem = views.deviceListHeaderOtherSessions.menu.findItem(R.id.otherSessionsHeaderMultiSignout) | ||
// Hide multi signout if we have an external account manager | ||
multiSignoutItem.isVisible = state.externalAccountManagementUrl == null | ||
val nbDevices = otherDevices.size | ||
multiSignoutItem.title = stringProvider.getQuantityString(R.plurals.device_manager_other_sessions_multi_signout_all, nbDevices, nbDevices) | ||
multiSignoutItem.setTextColor(colorDestructive) | ||
|
@@ -377,23 +380,24 @@ class VectorSettingsDevicesFragment : | |
views.deviceListOtherSessions.isVisible = false | ||
} | ||
|
||
private fun renderCurrentSessionView(currentDeviceInfo: DeviceFullInfo?, hasOtherDevices: Boolean) { | ||
private fun renderCurrentSessionView(currentDeviceInfo: DeviceFullInfo?, hasOtherDevices: Boolean, state: DevicesViewState) { | ||
currentDeviceInfo?.let { | ||
renderCurrentSessionHeaderView(hasOtherDevices) | ||
renderCurrentSessionHeaderView(hasOtherDevices, state) | ||
renderCurrentSessionListView(it) | ||
} ?: run { | ||
hideCurrentSessionView() | ||
} | ||
} | ||
|
||
private fun renderCurrentSessionHeaderView(hasOtherDevices: Boolean) { | ||
private fun renderCurrentSessionHeaderView(hasOtherDevices: Boolean, state: DevicesViewState) { | ||
views.deviceListHeaderCurrentSession.isVisible = true | ||
val colorDestructive = colorProvider.getColorFromAttribute(R.attr.colorError) | ||
val signoutSessionItem = views.deviceListHeaderCurrentSession.menu.findItem(R.id.currentSessionHeaderSignout) | ||
signoutSessionItem.setTextColor(colorDestructive) | ||
val signoutOtherSessionsItem = views.deviceListHeaderCurrentSession.menu.findItem(R.id.currentSessionHeaderSignoutOtherSessions) | ||
signoutOtherSessionsItem.setTextColor(colorDestructive) | ||
signoutOtherSessionsItem.isVisible = hasOtherDevices | ||
// Hide signout other sessions if we have an external account manager | ||
signoutOtherSessionsItem.isVisible = hasOtherDevices && state.externalAccountManagementUrl == null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto should be linked to |
||
} | ||
|
||
private fun renderCurrentSessionListView(currentDeviceInfo: DeviceFullInfo) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,10 +103,15 @@ class OtherSessionsFragment : | |
val nbDevices = viewState.devices()?.size ?: 0 | ||
stringProvider.getQuantityString(R.plurals.device_manager_other_sessions_multi_signout_all, nbDevices, nbDevices) | ||
} | ||
multiSignoutItem.isVisible = if (viewState.isSelectModeEnabled) { | ||
viewState.devices.invoke()?.any { it.isSelected }.orFalse() | ||
multiSignoutItem.isVisible = if (viewState.externalAccountManagementUrl != null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto should be linked to |
||
// Hide multi signout if we have an external account manager | ||
false | ||
} else { | ||
viewState.devices.invoke()?.isNotEmpty().orFalse() | ||
if (viewState.isSelectModeEnabled) { | ||
viewState.devices.invoke()?.any { it.isSelected }.orFalse() | ||
} else { | ||
viewState.devices.invoke()?.isNotEmpty().orFalse() | ||
} | ||
} | ||
val showAsActionFlag = if (viewState.isSelectModeEnabled) MenuItem.SHOW_AS_ACTION_IF_ROOM else MenuItem.SHOW_AS_ACTION_NEVER | ||
multiSignoutItem.setShowAsAction(showAsActionFlag or MenuItem.SHOW_AS_ACTION_WITH_TEXT) | ||
|
@@ -308,7 +313,10 @@ class OtherSessionsFragment : | |
) | ||
) | ||
views.otherSessionsNotFoundTextView.text = getString(R.string.device_manager_other_sessions_no_inactive_sessions_found) | ||
updateSecurityLearnMoreButton(R.string.device_manager_learn_more_sessions_inactive_title, R.string.device_manager_learn_more_sessions_inactive) | ||
updateSecurityLearnMoreButton( | ||
R.string.device_manager_learn_more_sessions_inactive_title, | ||
R.string.device_manager_learn_more_sessions_inactive | ||
) | ||
} | ||
DeviceManagerFilterType.ALL_SESSIONS -> { /* NOOP. View is not visible */ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because delegated OIDC can be enabled on the homeserver, but the homeserver does not have to provide an external account managemnt URL this should be tried to a new property like
HomeServerCapabilities.delegatedOidcAuthEnabled
.See https://github.com/vector-im/element-android/pull/8627/files#r1305379005 for more context.