-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show attributes shared with sp's after sign up
**Why**: Currently we only show the shared attributes once after the initial sign up. This change shows sign up completed with a new "First time logging in" message along with the new attributes being sent. Page is only shown when new attributes are being shared with an SP.
- Loading branch information
Nick Bristow
authored and
Nick Bristow
committed
Feb 5, 2018
1 parent
adab037
commit 4b58322
Showing
28 changed files
with
390 additions
and
64 deletions.
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
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,51 @@ | ||
module VerifySPAttributesConcern | ||
def needs_sp_attribute_verification? | ||
if sp_session_identity.nil? || !requested_attributes_verified? | ||
set_verify_shared_attributes_session | ||
true | ||
else | ||
clear_verify_attributes_sessions | ||
false | ||
end | ||
end | ||
|
||
def update_verified_attributes | ||
IdentityLinker.new( | ||
current_user, | ||
sp_session[:issuer] | ||
).link_identity( | ||
ial: sp_session_ial, | ||
verified_attributes: sp_session[:requested_attributes] | ||
) | ||
end | ||
|
||
def set_verify_shared_attributes_session | ||
user_session[:verify_shared_attributes] = true | ||
end | ||
|
||
def new_service_provider_attributes | ||
user_session[:verify_shared_attributes] if | ||
user_session.class == ActiveSupport::HashWithIndifferentAccess | ||
end | ||
|
||
def clear_verify_attributes_sessions | ||
user_session[:verify_shared_attributes] = false | ||
end | ||
|
||
private | ||
|
||
def sp_session_identity | ||
@sp_session_identity = | ||
current_user&.identities&.find_by(service_provider: sp_session[:issuer]) | ||
end | ||
|
||
def requested_attributes_verified? | ||
@sp_session_identity && ( | ||
sp_session[:requested_attributes] - @sp_session_identity.verified_attributes.to_a | ||
).empty? | ||
end | ||
|
||
def sp_session_ial | ||
sp_session[:loa3] ? 3 : 1 | ||
end | ||
end |
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
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
Oops, something went wrong.