Skip to content

Instantly share code, notes, and snippets.

@tdhsmith
Last active February 10, 2016 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdhsmith/ec328a3db37ffe4718bd to your computer and use it in GitHub Desktop.
Save tdhsmith/ec328a3db37ffe4718bd to your computer and use it in GitHub Desktop.
Simplified flow for default user model interactions in JWTAuth
# http://www.graphviz.org/content/cluster
digraph G {
rankdir = LR;
splines = line;
subgraph cluster_package {
subgraph cluster_0 {
color=blue;
node [style=filled];
label = "JWT";
subgraph cluster_1 {
rank=same;
color=purple;
node [style=filled];
label = "JWTAuth";
toUser -> authenticate [constraint=false];
attempt;
}
fromUser;
}
subgraph cluster_2 {
node [style=filled];
label = "Auth provider\n(Illuminate)";
color=red;
byId;
byCredentials;
}
subgraph cluster_5 {
node [style=filled];
label = "JWTSubject";
color=teal;
subgraph cluster_8 {
node [style=filled];
label = "User";
style= dashed;
color=teal;
getJWTIdentifier;
}
}
style=dotted;
label="jwt-auth library";
}
subgraph cluster_3 {
node [style=filled];
label = "Guard contract\n(SessionGuard)";
color=orange;
onceUsingId;
once -> "attempt " -> hasValidCredentials [constraint=false];
};
subgraph cluster_4 {
node [style=filled];
label = "User provider\n(EloquentUserProvider)";
color=green;
retrieveById;
retrieveByCredentials;
validateCredentials;
}
subgraph cluster_6 {
node [style=filled];
label = "Model queries\n(QueryBuilder)";
color=gray;
find -> where [constraint=false];
}
subgraph cluster_7 {
node [style=filled];
label = "Hasher";
color=gray;
check;
}
START [shape=diamond];
START -> toUser;
START -> fromUser -> getJWTIdentifier;
START -> authenticate -> byId;
byId -> onceUsingId [constraint=false];
onceUsingId -> retrieveById -> find;
START -> attempt -> byCredentials;
byCredentials -> once [constraint=false];
getJWTIdentifier -> onceUsingId [style=invis];
"attempt " -> retrieveByCredentials -> where;
hasValidCredentials -> validateCredentials -> check;
}
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.38.0 (20140413.2041)
-->
<!-- Title: G Pages: 1 -->
<svg width="1049pt" height="360pt"
viewBox="0.00 0.00 1048.62 360.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 356)">
<title>G</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-356 1044.62,-356 1044.62,4 -4,4"/>
<g id="clust1" class="cluster"><title>cluster_package</title>
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="129.706,-29 129.706,-344 488.149,-344 488.149,-29 129.706,-29"/>
<text text-anchor="middle" x="308.927" y="-327.4" font-family="Times,serif" font-size="14.00">jwt&#45;auth library</text>
</g>
<g id="clust2" class="cluster"><title>cluster_0</title>
<polygon fill="none" stroke="blue" points="137.706,-37 137.706,-307 285.086,-307 285.086,-37 137.706,-37"/>
<text text-anchor="middle" x="211.396" y="-290.4" font-family="Times,serif" font-size="14.00">JWT</text>
</g>
<g id="clust3" class="cluster"><title>cluster_1</title>
<polygon fill="none" stroke="purple" points="145.706,-45 145.706,-230 277.086,-230 277.086,-45 145.706,-45"/>
<text text-anchor="middle" x="211.396" y="-213.4" font-family="Times,serif" font-size="14.00">JWTAuth</text>
</g>
<g id="clust4" class="cluster"><title>cluster_2</title>
<polygon fill="none" stroke="red" points="313.945,-37 313.945,-185 459.289,-185 459.289,-37 313.945,-37"/>
<text text-anchor="middle" x="386.617" y="-168.4" font-family="Times,serif" font-size="14.00">Auth provider</text>
<text text-anchor="middle" x="386.617" y="-151.6" font-family="Times,serif" font-size="14.00">(Illuminate)</text>
</g>
<g id="clust5" class="cluster"><title>cluster_5</title>
<polygon fill="none" stroke="teal" points="293.086,-193 293.086,-311 480.149,-311 480.149,-193 293.086,-193"/>
<text text-anchor="middle" x="386.617" y="-294.4" font-family="Times,serif" font-size="14.00">JWTSubject</text>
</g>
<g id="clust6" class="cluster"><title>cluster_8</title>
<polygon fill="none" stroke="teal" stroke-dasharray="5,2" points="301.086,-201 301.086,-278 472.149,-278 472.149,-201 301.086,-201"/>
<text text-anchor="middle" x="386.617" y="-261.4" font-family="Times,serif" font-size="14.00">User</text>
</g>
<g id="clust7" class="cluster"><title>cluster_3</title>
<polygon fill="none" stroke="orange" points="496.149,-39 496.149,-295 690.828,-295 690.828,-39 496.149,-39"/>
<text text-anchor="middle" x="593.488" y="-278.4" font-family="Times,serif" font-size="14.00">Guard contract</text>
<text text-anchor="middle" x="593.488" y="-261.6" font-family="Times,serif" font-size="14.00">(SessionGuard)</text>
</g>
<g id="clust8" class="cluster"><title>cluster_4</title>
<polygon fill="none" stroke="green" points="710.828,-39 710.828,-241 918.367,-241 918.367,-39 710.828,-39"/>
<text text-anchor="middle" x="814.598" y="-224.4" font-family="Times,serif" font-size="14.00">User provider</text>
<text text-anchor="middle" x="814.598" y="-207.6" font-family="Times,serif" font-size="14.00">(EloquentUserProvider)</text>
</g>
<g id="clust9" class="cluster"><title>cluster_6</title>
<polygon fill="none" stroke="gray" points="938.367,-93 938.367,-241 1040.62,-241 1040.62,-93 938.367,-93"/>
<text text-anchor="middle" x="989.492" y="-224.4" font-family="Times,serif" font-size="14.00">Model queries</text>
<text text-anchor="middle" x="989.492" y="-207.6" font-family="Times,serif" font-size="14.00">(QueryBuilder)</text>
</g>
<g id="clust10" class="cluster"><title>cluster_7</title>
<polygon fill="none" stroke="gray" points="947.438,-8 947.438,-85 1030.55,-85 1030.55,-8 947.438,-8"/>
<text text-anchor="middle" x="988.992" y="-68.4" font-family="Times,serif" font-size="14.00">Hasher</text>
</g>
<!-- toUser -->
<g id="node1" class="node"><title>toUser</title>
<ellipse fill="lightgrey" stroke="black" cx="211.396" cy="-179" rx="36.5555" ry="18"/>
<text text-anchor="middle" x="211.396" y="-174.8" font-family="Times,serif" font-size="14.00">toUser</text>
</g>
<!-- authenticate -->
<g id="node2" class="node"><title>authenticate</title>
<ellipse fill="lightgrey" stroke="black" cx="211.396" cy="-125" rx="57.881" ry="18"/>
<text text-anchor="middle" x="211.396" y="-120.8" font-family="Times,serif" font-size="14.00">authenticate</text>
</g>
<!-- toUser&#45;&gt;authenticate -->
<g id="edge1" class="edge"><title>toUser&#45;&gt;authenticate</title>
<path fill="none" stroke="black" d="M211.396,-160.79C211.396,-158.308 211.396,-155.826 211.396,-153.344"/>
<polygon fill="black" stroke="black" points="214.896,-153.141 211.396,-143.141 207.896,-153.141 214.896,-153.141"/>
</g>
<!-- byId -->
<g id="node5" class="node"><title>byId</title>
<ellipse fill="lightgrey" stroke="black" cx="386.617" cy="-117" rx="28.9754" ry="18"/>
<text text-anchor="middle" x="386.617" y="-112.8" font-family="Times,serif" font-size="14.00">byId</text>
</g>
<!-- authenticate&#45;&gt;byId -->
<g id="edge9" class="edge"><title>authenticate&#45;&gt;byId</title>
<path fill="none" stroke="black" d="M268.636,-122.403C294.508,-121.208 324.519,-119.822 347.666,-118.753"/>
<polygon fill="black" stroke="black" points="347.951,-122.243 357.779,-118.286 347.628,-115.251 347.951,-122.243"/>
</g>
<!-- attempt -->
<g id="node3" class="node"><title>attempt</title>
<ellipse fill="lightgrey" stroke="black" cx="211.396" cy="-71" rx="40.0031" ry="18"/>
<text text-anchor="middle" x="211.396" y="-66.8" font-family="Times,serif" font-size="14.00">attempt</text>
</g>
<!-- byCredentials -->
<g id="node6" class="node"><title>byCredentials</title>
<ellipse fill="lightgrey" stroke="black" cx="386.617" cy="-63" rx="64.8447" ry="18"/>
<text text-anchor="middle" x="386.617" y="-58.8" font-family="Times,serif" font-size="14.00">byCredentials</text>
</g>
<!-- attempt&#45;&gt;byCredentials -->
<g id="edge14" class="edge"><title>attempt&#45;&gt;byCredentials</title>
<path fill="none" stroke="black" d="M251.27,-69.2046C269.357,-68.3693 291.484,-67.3474 312.52,-66.3759"/>
<polygon fill="black" stroke="black" points="312.909,-69.8618 322.737,-65.904 312.586,-62.8692 312.909,-69.8618"/>
</g>
<!-- fromUser -->
<g id="node4" class="node"><title>fromUser</title>
<ellipse fill="lightgrey" stroke="black" cx="211.396" cy="-256" rx="48.0703" ry="18"/>
<text text-anchor="middle" x="211.396" y="-251.8" font-family="Times,serif" font-size="14.00">fromUser</text>
</g>
<!-- getJWTIdentifier -->
<g id="node7" class="node"><title>getJWTIdentifier</title>
<ellipse fill="lightgrey" stroke="black" cx="386.617" cy="-227" rx="77.5627" ry="18"/>
<text text-anchor="middle" x="386.617" y="-222.8" font-family="Times,serif" font-size="14.00">getJWTIdentifier</text>
</g>
<!-- fromUser&#45;&gt;getJWTIdentifier -->
<g id="edge7" class="edge"><title>fromUser&#45;&gt;getJWTIdentifier</title>
<path fill="none" stroke="black" d="M255.66,-248.757C273.068,-245.842 293.624,-242.401 313.188,-239.126"/>
<polygon fill="black" stroke="black" points="314.021,-242.535 323.306,-237.432 312.865,-235.631 314.021,-242.535"/>
</g>
<!-- onceUsingId -->
<g id="node8" class="node"><title>onceUsingId</title>
<ellipse fill="lightgrey" stroke="black" cx="593.488" cy="-227" rx="60.2556" ry="18"/>
<text text-anchor="middle" x="593.488" y="-222.8" font-family="Times,serif" font-size="14.00">onceUsingId</text>
</g>
<!-- byId&#45;&gt;onceUsingId -->
<g id="edge10" class="edge"><title>byId&#45;&gt;onceUsingId</title>
<path fill="none" stroke="black" d="M409.155,-128.564C443.611,-147.064 511.595,-183.566 554.395,-206.547"/>
<polygon fill="black" stroke="black" points="552.921,-209.728 563.387,-211.375 556.232,-203.561 552.921,-209.728"/>
</g>
<!-- once -->
<g id="node9" class="node"><title>once</title>
<ellipse fill="lightgrey" stroke="black" cx="593.488" cy="-173" rx="29.0356" ry="18"/>
<text text-anchor="middle" x="593.488" y="-168.8" font-family="Times,serif" font-size="14.00">once</text>
</g>
<!-- byCredentials&#45;&gt;once -->
<g id="edge15" class="edge"><title>byCredentials&#45;&gt;once</title>
<path fill="none" stroke="black" d="M417.407,-78.9949C455.875,-99.6491 522.502,-135.423 561.53,-156.378"/>
<polygon fill="black" stroke="black" points="560.358,-159.721 570.824,-161.368 563.669,-153.554 560.358,-159.721"/>
</g>
<!-- getJWTIdentifier&#45;&gt;onceUsingId -->
<!-- retrieveById -->
<g id="node12" class="node"><title>retrieveById</title>
<ellipse fill="lightgrey" stroke="black" cx="814.598" cy="-173" rx="59.6685" ry="18"/>
<text text-anchor="middle" x="814.598" y="-168.8" font-family="Times,serif" font-size="14.00">retrieveById</text>
</g>
<!-- onceUsingId&#45;&gt;retrieveById -->
<g id="edge11" class="edge"><title>onceUsingId&#45;&gt;retrieveById</title>
<path fill="none" stroke="black" d="M640.688,-215.614C674.888,-207.185 721.638,-195.664 757.905,-186.726"/>
<polygon fill="black" stroke="black" points="758.965,-190.069 767.837,-184.278 757.29,-183.272 758.965,-190.069"/>
</g>
<!-- attempt -->
<g id="node10" class="node"><title>attempt </title>
<ellipse fill="lightgrey" stroke="black" cx="593.488" cy="-119" rx="42.3317" ry="18"/>
<text text-anchor="middle" x="593.488" y="-114.8" font-family="Times,serif" font-size="14.00">attempt </text>
</g>
<!-- once&#45;&gt;attempt -->
<g id="edge2" class="edge"><title>once&#45;&gt;attempt </title>
<path fill="none" stroke="black" d="M593.488,-154.79C593.488,-152.308 593.488,-149.826 593.488,-147.344"/>
<polygon fill="black" stroke="black" points="596.989,-147.141 593.488,-137.141 589.989,-147.141 596.989,-147.141"/>
</g>
<!-- hasValidCredentials -->
<g id="node11" class="node"><title>hasValidCredentials</title>
<ellipse fill="lightgrey" stroke="black" cx="593.488" cy="-65" rx="89.18" ry="18"/>
<text text-anchor="middle" x="593.488" y="-60.8" font-family="Times,serif" font-size="14.00">hasValidCredentials</text>
</g>
<!-- attempt &#45;&gt;hasValidCredentials -->
<g id="edge3" class="edge"><title>attempt &#45;&gt;hasValidCredentials</title>
<path fill="none" stroke="black" d="M593.488,-100.79C593.488,-98.3082 593.488,-95.8262 593.488,-93.3443"/>
<polygon fill="black" stroke="black" points="596.989,-93.1406 593.488,-83.1406 589.989,-93.1407 596.989,-93.1406"/>
</g>
<!-- retrieveByCredentials -->
<g id="node13" class="node"><title>retrieveByCredentials</title>
<ellipse fill="lightgrey" stroke="black" cx="814.598" cy="-119" rx="95.5394" ry="18"/>
<text text-anchor="middle" x="814.598" y="-114.8" font-family="Times,serif" font-size="14.00">retrieveByCredentials</text>
</g>
<!-- attempt &#45;&gt;retrieveByCredentials -->
<g id="edge17" class="edge"><title>attempt &#45;&gt;retrieveByCredentials</title>
<path fill="none" stroke="black" d="M635.959,-119C656.66,-119 682.733,-119 708.48,-119"/>
<polygon fill="black" stroke="black" points="708.702,-122.5 718.702,-119 708.702,-115.5 708.702,-122.5"/>
</g>
<!-- validateCredentials -->
<g id="node14" class="node"><title>validateCredentials</title>
<ellipse fill="lightgrey" stroke="black" cx="814.598" cy="-65" rx="85.6667" ry="18"/>
<text text-anchor="middle" x="814.598" y="-60.8" font-family="Times,serif" font-size="14.00">validateCredentials</text>
</g>
<!-- hasValidCredentials&#45;&gt;validateCredentials -->
<g id="edge19" class="edge"><title>hasValidCredentials&#45;&gt;validateCredentials</title>
<path fill="none" stroke="black" d="M682.977,-65C694.644,-65 706.641,-65 718.414,-65"/>
<polygon fill="black" stroke="black" points="718.687,-68.5001 728.687,-65 718.687,-61.5001 718.687,-68.5001"/>
</g>
<!-- find -->
<g id="node15" class="node"><title>find</title>
<ellipse fill="lightgrey" stroke="black" cx="988.992" cy="-173" rx="27" ry="18"/>
<text text-anchor="middle" x="988.992" y="-168.8" font-family="Times,serif" font-size="14.00">find</text>
</g>
<!-- retrieveById&#45;&gt;find -->
<g id="edge12" class="edge"><title>retrieveById&#45;&gt;find</title>
<path fill="none" stroke="black" d="M874.444,-173C900.042,-173 929.231,-173 951.604,-173"/>
<polygon fill="black" stroke="black" points="951.68,-176.5 961.68,-173 951.68,-169.5 951.68,-176.5"/>
</g>
<!-- where -->
<g id="node16" class="node"><title>where</title>
<ellipse fill="lightgrey" stroke="black" cx="988.992" cy="-119" rx="34.7496" ry="18"/>
<text text-anchor="middle" x="988.992" y="-114.8" font-family="Times,serif" font-size="14.00">where</text>
</g>
<!-- retrieveByCredentials&#45;&gt;where -->
<g id="edge18" class="edge"><title>retrieveByCredentials&#45;&gt;where</title>
<path fill="none" stroke="black" d="M910.368,-119C922.104,-119 933.626,-119 944.052,-119"/>
<polygon fill="black" stroke="black" points="944.08,-122.5 954.08,-119 944.08,-115.5 944.08,-122.5"/>
</g>
<!-- check -->
<g id="node17" class="node"><title>check</title>
<ellipse fill="lightgrey" stroke="black" cx="988.992" cy="-34" rx="33.6073" ry="18"/>
<text text-anchor="middle" x="988.992" y="-29.8" font-family="Times,serif" font-size="14.00">check</text>
</g>
<!-- validateCredentials&#45;&gt;check -->
<g id="edge20" class="edge"><title>validateCredentials&#45;&gt;check</title>
<path fill="none" stroke="black" d="M880.281,-53.3685C902.574,-49.3599 926.918,-44.9824 946.813,-41.4048"/>
<polygon fill="black" stroke="black" points="947.555,-44.8277 956.777,-39.613 946.316,-37.9382 947.555,-44.8277"/>
</g>
<!-- find&#45;&gt;where -->
<g id="edge4" class="edge"><title>find&#45;&gt;where</title>
<path fill="none" stroke="black" d="M988.992,-154.79C988.992,-152.308 988.992,-149.826 988.992,-147.344"/>
<polygon fill="black" stroke="black" points="992.492,-147.141 988.992,-137.141 985.492,-147.141 992.492,-147.141"/>
</g>
<!-- START -->
<g id="node18" class="node"><title>START</title>
<polygon fill="none" stroke="black" points="58.8528,-170 0.14682,-152 58.8528,-134 117.559,-152 58.8528,-170"/>
<text text-anchor="middle" x="58.8528" y="-147.8" font-family="Times,serif" font-size="14.00">START</text>
</g>
<!-- START&#45;&gt;toUser -->
<g id="edge5" class="edge"><title>START&#45;&gt;toUser</title>
<path fill="none" stroke="black" d="M96.2951,-158.536C117.5,-162.339 144.366,-167.157 166.701,-171.163"/>
<polygon fill="black" stroke="black" points="166.147,-174.62 176.608,-172.94 167.383,-167.73 166.147,-174.62"/>
</g>
<!-- START&#45;&gt;authenticate -->
<g id="edge8" class="edge"><title>START&#45;&gt;authenticate</title>
<path fill="none" stroke="black" d="M96.2951,-145.464C112.668,-142.528 132.417,-138.986 150.849,-135.68"/>
<polygon fill="black" stroke="black" points="151.698,-139.083 160.923,-133.873 150.462,-132.193 151.698,-139.083"/>
</g>
<!-- START&#45;&gt;attempt -->
<g id="edge13" class="edge"><title>START&#45;&gt;attempt</title>
<path fill="none" stroke="black" d="M81.1027,-140.566C105.749,-127.305 146.727,-105.257 175.943,-89.5374"/>
<polygon fill="black" stroke="black" points="177.832,-92.4955 184.98,-84.675 174.515,-86.3311 177.832,-92.4955"/>
</g>
<!-- START&#45;&gt;fromUser -->
<g id="edge6" class="edge"><title>START&#45;&gt;fromUser</title>
<path fill="none" stroke="black" d="M77.7132,-164.339C102.666,-181.577 148.342,-213.131 179.037,-234.336"/>
<polygon fill="black" stroke="black" points="177.437,-237.485 187.654,-240.289 181.416,-231.726 177.437,-237.485"/>
</g>
</g>
</svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment