Skip to content

Instantly share code, notes, and snippets.

@perenecabuto
Last active February 8, 2017 06:21
Show Gist options
  • Save perenecabuto/bf7fc5cf7fea9ecf44d7e90163039b74 to your computer and use it in GitHub Desktop.
Save perenecabuto/bf7fc5cf7fea9ecf44d7e90163039b74 to your computer and use it in GitHub Desktop.
push-auth-diagram.puml
@startuml
|user|
start
:open the app for the first time;
:click login button;
|mobile auth SDK|
:Check if there is an API AuthToken;
if (already have a token?) then
:YES;
else
->NO;
:request an AuthToken
with AppID and the GCM InstanceID;
fork
|mobile auth SDK|
:wait for AuthToken from GCM
until time out;
note right
It retries X time
to request the AuthToken again
and wait for Y seconds
each attempt
end note
fork again
|push credentials API|
:receive the request for an AuthToken;
:do some validation and black list check;
if (everything is ok?) then
->NO;
|push credentials API|
:notify the error;
else
->YES;
:generate an AuthToken for
the instaled APP on device;
|GCM|
:send the AuthToken to the APP in the device;
|mobile auth SDK|
:receive and store
the AuthToken;
endif
|push credentials API|
:send response status code;
end fork
endif
|mobile auth SDK|
if (error occured?) then
:NO;
:open native login screen;
else
:YES;
:open fallback screen (webview);
:the whole flow follows on webview;
:when user is authenticated;
|user|
-> return a Globo User to the app;
:user authenticated;
stop
endif
|user|
:fill de login form
with credentials;
:click on login button;
|mobile auth SDK|
:do authentication request
with User Credentails, GCM InstanceID and AuthToken;
|login API|
:check if AuthToken is valid
for GCM InstanceID;
|push credentials API|
:validate GCM InstanceID
and AuthToken;
|login API|
if (is valid?) then
:check User Credentials;
:respond with User authentication
status code;
else
:respond with API authentication
failure status code;
endif
|mobile auth SDK|
if (AuthToken is valid?) then
->YES;
if (User Credentails are valid?) then
->YES;
:return an
authenticated Globo User;
else
->NO;
|mobile auth SDK|
:notify user about
the wrong credentials;
stop
endif
else
->NO;
:request an AuthToken
again;
stop
endif
|user|
:user authenticated;
stop
@enduml
http://www.plantuml.com/plantuml/svg/XLRRRjim37ttL_1n1ROVS82jHJiKmR2jG3TWVPHbEXQYI9uanoYGZnyfARxajgVK5dbuT0v9zzu7uKA_qyMXz-WEHNmkIjkXWT0YYAw3nhhuTwES3n3K3bT5ARMIMz1semnKVGZMh8hYiBELqfJLXnPUdxuTYlAnHOfJ3ICu1EL167XuMSC3nVooMwGyElqWj4DHlqChzfGFWK--t76MAG3Ajw-lgmArHthuzFd7pnM_TFYtHwB4Y4SqUZyeglxGTUidEgaZzUV7xx0sT3aZSVr4J85ljQMVSye4F0WLuhL7M6YStJ4C7VScA1rr0Di7Pc9iG71gqmPw05W7S1YSGWz_Obny6omS2JEb2LfiX38nXEcEjT_0exIczl48XMn1X82xZeiWHNBLuqr6a4FN-nQamng9fj2UnJuajIGg4fUB7ubmdRbwKTRQWhTqkRtGgXP1MHE9LLgmuuhI99lAiUmSxj6zXrQP3RjhjvDharKtU551keXgtYCnTCuwpiXUCqJqFWPkqA0JfFMSCryY2KpvYatMM1Fw2n3n6lTAOgP0zkMA7dDZJ2XaJtn1UIhr_YBtGflCD6LzVB0EHo8BIQcQQcwQ4mavz9qr7WbAXDw3j3NczDIk2UV2c4KVM3gmKlQ4FpUXF7gGnjgGfKGvZQudCinnbBkSr8xHZT2wOkDJ97mOiDeh7Evo4DzrQ2snQRGTYAQc7y_Ivy0SDn0Ru1qJLq3Fv8AIv6MT1Kxx9pdEuzCxQZjurhQoy9lpia6qaJ9aHBi0HKPqerG9jcoKrcHelZM9kIlYcfXvCIurulx_lKP3CYlDCv9dAk56ney9N2ZjFvwieDWninuf3gbax8TI7fVcr9waMfp7WaVsR9rTQQmoZ_3f0YnkLUTUEbPRj55YDRzPaYrF0lTk3TFjb_9aPsPzFRNS8fU_3HTI6rAH6li4ujOyd6ktt4nZetFmgLyW79uddIHcygbLfuX5IyuwE2MDrrxkn-jBPhuYKyjNzDaPZ-80EalRLvwQCWv3h1krcgtLSIjS-On2-gPSdwbBynVZxYcG_gVu1m00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment