UNPKG

passport-fellowshipone

Version:

Fellowship One (F1) authentication strategy for Passport.

1,370 lines (1,333 loc) 48.2 kB
<!doctype html> <html lang="en"> <head> <title>Code coverage report for passport-fellowshipone/strategy.js</title> <meta charset="utf-8"> <link rel="stylesheet" href="../prettify.css"> <style> body, html { margin:0; padding: 0; } body { font-family: Helvetica Neue, Helvetica,Arial; font-size: 10pt; } div.header, div.footer { background: #eee; padding: 1em; } div.header { z-index: 100; position: fixed; top: 0; border-bottom: 1px solid #666; width: 100%; } div.footer { border-top: 1px solid #666; } div.body { margin-top: 10em; } div.meta { font-size: 90%; text-align: center; } h1, h2, h3 { font-weight: normal; } h1 { font-size: 12pt; } h2 { font-size: 10pt; } pre { font-family: Consolas, Menlo, Monaco, monospace; margin: 0; padding: 0; line-height: 14px; font-size: 14px; -moz-tab-size: 2; -o-tab-size: 2; tab-size: 2; } div.path { font-size: 110%; } div.path a:link, div.path a:visited { color: #000; } table.coverage { border-collapse: collapse; margin:0; padding: 0 } table.coverage td { margin: 0; padding: 0; color: #111; vertical-align: top; } table.coverage td.line-count { width: 50px; text-align: right; padding-right: 5px; } table.coverage td.line-coverage { color: #777 !important; text-align: right; border-left: 1px solid #666; border-right: 1px solid #666; } table.coverage td.text { } table.coverage td span.cline-any { display: inline-block; padding: 0 5px; width: 40px; } table.coverage td span.cline-neutral { background: #eee; } table.coverage td span.cline-yes { background: #b5d592; color: #999; } table.coverage td span.cline-no { background: #fc8c84; } .cstat-yes { color: #111; } .cstat-no { background: #fc8c84; color: #111; } .fstat-no { background: #ffc520; color: #111 !important; } .cbranch-no { background: yellow !important; color: #111; } .cstat-skip { background: #ddd; color: #111; } .fstat-skip { background: #ddd; color: #111 !important; } .cbranch-skip { background: #ddd !important; color: #111; } .missing-if-branch { display: inline-block; margin-right: 10px; position: relative; padding: 0 4px; background: black; color: yellow; } .skip-if-branch { display: none; margin-right: 10px; position: relative; padding: 0 4px; background: #ccc; color: white; } .missing-if-branch .typ, .skip-if-branch .typ { color: inherit !important; } .entity, .metric { font-weight: bold; } .metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; } .metric small { font-size: 80%; font-weight: normal; color: #666; } div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; } div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; } div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; } div.coverage-summary th.file { border-right: none !important; } div.coverage-summary th.pic { border-left: none !important; text-align: right; } div.coverage-summary th.pct { border-right: none !important; } div.coverage-summary th.abs { border-left: none !important; text-align: right; } div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; } div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; } div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; } div.coverage-summary td.pic { min-width: 120px !important; } div.coverage-summary a:link { text-decoration: none; color: #000; } div.coverage-summary a:visited { text-decoration: none; color: #333; } div.coverage-summary a:hover { text-decoration: underline; } div.coverage-summary tfoot td { border-top: 1px solid #666; } div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator { height: 10px; width: 7px; display: inline-block; margin-left: 0.5em; } div.coverage-summary .yui3-datatable-sort-indicator { background: url("https://yui-s.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent; } div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator { background-position: 0 -20px; } div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator { background-position: 0 -10px; } .high { background: #b5d592 !important; } .medium { background: #ffe87c !important; } .low { background: #fc8c84 !important; } span.cover-fill, span.cover-empty { display:inline-block; border:1px solid #444; background: white; height: 12px; } span.cover-fill { background: #ccc; border-right: 1px solid #444; } span.cover-empty { background: white; border-left: none; } span.cover-full { border-right: none !important; } pre.prettyprint { border: none !important; padding: 0 !important; margin: 0 !important; } .com { color: #999 !important; } .ignore-none { color: #999; font-weight: normal; } </style> </head> <body> <div class="header medium"> <h1>Code coverage report for <span class="entity">passport-fellowshipone/strategy.js</span></h1> <h2> Statements: <span class="metric">50.65% <small>(78 / 154)</small></span> &nbsp;&nbsp;&nbsp;&nbsp; Branches: <span class="metric">32.11% <small>(35 / 109)</small></span> &nbsp;&nbsp;&nbsp;&nbsp; Functions: <span class="metric">65% <small>(13 / 20)</small></span> &nbsp;&nbsp;&nbsp;&nbsp; Lines: <span class="metric">51.06% <small>(72 / 141)</small></span> &nbsp;&nbsp;&nbsp;&nbsp; Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp; </h2> <div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">passport-fellowshipone/</a> &#187; strategy.js</div> </div> <div class="body"> <pre><table class="coverage"> <tr><td class="line-count">1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350</td><td class="line-coverage"><span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">15</span> <span class="cline-any cline-yes">15</span> <span class="cline-any cline-yes">15</span> <span class="cline-any cline-yes">15</span> <span class="cline-any cline-yes">15</span> <span class="cline-any cline-yes">15</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">15</span> <span class="cline-any cline-yes">15</span> <span class="cline-any cline-yes">15</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">15</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">15</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">60</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">2</span> <span class="cline-any cline-yes">2</span> <span class="cline-any cline-yes">2</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">2</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">2</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">10</span> <span class="cline-any cline-yes">10</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">7</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">6</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">5</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">4</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">5</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">2</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-yes">7</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">5</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">5</span> <span class="cline-any cline-yes">5</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes">1</span> <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">/** * Module dependencies. */ var util = require('util'), OAuthStrategy = require('passport-oauth').OAuthStrategy, InternalOAuthError = require('passport-oauth').InternalOAuthError, querystring = require('querystring'), URL = require('url'), URI = require('URIjs'), URITemplate = require('URIjs/src/URITemplate'), async = require('async'), request = require('request'); &nbsp; /** * `Strategy` constructor. * * The FellowshipOne authentication strategy authenticates requests by delegating * to Fellowship One using the OAuth 1.0a protocol. * * Applications must supply a `verify` callback which accepts a `token`, * `tokenSecret` and service-specific `profile`, and then calls the `done` * callback supplying a `user`, which should be set to `false` if the * credentials are not valid. If an exception occured, `err` should be set. * * Options: * - `churchCode` Your Fellowship One church code * - `staging` Whether we're using staging or production * - `consumerKey` Fellowship One Developer Key * - `consumerSecret` Fellowship One Secret Key * - `callbackURL` URL to which Fellowship One will redirect the user after obtaining authorization * * Examples: * * passport.use(new F1Strategy({ * churchCode: 'MYCHURCH', * staging: true, * consumerKey: '123', * consumerSecret: 'xxx' * callbackURL: 'https://www.example.net/auth/fellowshipone/callback' * }, * function(token, tokenSecret, profile, done) { * User.findOrCreate(..., function (err, user) { * done(err, user); * }); * } * )); * * @param {Object} options * @param {Function} verify * @api public */ &nbsp; function Strategy(options, verify) { options = options || <span class="branch-1 cbranch-no" title="branch not covered" >{}</span> options.churchCode = options.churchCode options.apiURL = expand(options.apiURL || 'https://{churchCode}.fellowshiponeapi.com/v1', options) options.requestTokenURL = expand(options.requestTokenURL || options.apiURL + '/Tokens/RequestToken', options) options.accessTokenURL = expand(options.accessTokenURL || options.apiURL + '/Tokens/AccessToken', options) options.userAuthorizationURL = expand(options.userAuthorizationURL || options.apiURL + '/PortalUser/Login', options) &nbsp; OAuthStrategy.call(this, options, verify) this.options = options this.name = 'fellowshipone' &nbsp; // Override oauth.getOAuthAccessToken so that we can get the user profile from the // response headers. this._oauth.getOAuthAccessToken = this._getOAuthAccessToken.bind(this._oauth) &nbsp; // Override oauth._performSecureRequest to account for https://github.com/ciaranj/node-oauth/issues/182 this._oauth._performSecureRequest = this._performSecureRequest.bind(this._oauth) } &nbsp; /** * Inherit from `OAuthStrategy`. */ util.inherits(Strategy, OAuthStrategy); &nbsp; var expand = function(uri, options) { return URI.expand(uri, options).normalize().toString() } &nbsp; // Override oauth.getOAuthAccessToken so that we can get the user profile from the // response headers. Strategy.prototype._getOAuthAccessToken = function(oauth_token, oauth_token_secret, oauth_verifier, callback) { /* jshint sub: true */ var extraParams = {}; <span class="missing-if-branch" title="else path not taken" >E</span>if (typeof oauth_verifier == "function") { callback = oauth_verifier; } else { <span class="cstat-no" title="statement not covered" > extraParams.oauth_verifier = oauth_verifier;</span> } &nbsp; this._performSecureRequest(oauth_token, oauth_token_secret, this._clientOptions.accessTokenHttpMethod, this._accessUrl, extraParams, null, null, function(error, data, response) { if (error) callback(error); else { var results = querystring.parse(data); var oauth_access_token = results["oauth_token"]; delete results["oauth_token"]; var oauth_access_token_secret = results["oauth_token_secret"]; delete results["oauth_token_secret"]; &nbsp; // this is the only customization really results.userURL = response.headers['content-location'] &nbsp; callback(null, oauth_access_token, oauth_access_token_secret, results); } }) /* jshint sub: false */ } &nbsp; // Override oauth._performSecureRequest to account for https://github.com/ciaranj/node-oauth/issues/182 Strategy.prototype._performSecureRequest = <span class="fstat-no" title="function not covered" >function(oauth_token, oauth_token_secret, method, url, extra_params, post_body, post_content_type, callback) {</span> /* jshint shadow: true, sub: true, eqnull: true */ <span class="cstat-no" title="statement not covered" > var orderedParameters = this._prepareParameters(oauth_token, oauth_token_secret, method, url, extra_params);</span> &nbsp; <span class="cstat-no" title="statement not covered" > if (!post_content_type) {</span> <span class="cstat-no" title="statement not covered" > post_content_type = "application/x-www-form-urlencoded";</span> } <span class="cstat-no" title="statement not covered" > var parsedUrl = URL.parse(url, false);</span> <span class="cstat-no" title="statement not covered" > if (parsedUrl.protocol == "http:" &amp;&amp; !parsedUrl.port) <span class="cstat-no" title="statement not covered" >parsedUrl.port = 80;</span></span> <span class="cstat-no" title="statement not covered" > if (parsedUrl.protocol == "https:" &amp;&amp; !parsedUrl.port) <span class="cstat-no" title="statement not covered" >parsedUrl.port = 443;</span></span> &nbsp; <span class="cstat-no" title="statement not covered" > var headers = {};</span> <span class="cstat-no" title="statement not covered" > var authorization = this._buildAuthorizationHeaders(orderedParameters);</span> <span class="cstat-no" title="statement not covered" > if (this._isEcho) {</span> <span class="cstat-no" title="statement not covered" > headers["X-Verify-Credentials-Authorization"] = authorization;</span> } else { <span class="cstat-no" title="statement not covered" > headers["Authorization"] = authorization;</span> } &nbsp; <span class="cstat-no" title="statement not covered" > headers["Host"] = parsedUrl.host</span> &nbsp; <span class="cstat-no" title="statement not covered" > for (var key in this._headers) {</span> <span class="cstat-no" title="statement not covered" > if (this._headers.hasOwnProperty(key)) {</span> <span class="cstat-no" title="statement not covered" > headers[key] = this._headers[key];</span> } } &nbsp; // Filter out any passed extra_params that are really to do with OAuth <span class="cstat-no" title="statement not covered" > for (var key in extra_params) {</span> <span class="cstat-no" title="statement not covered" > if (this._isParameterNameAnOAuthParameter(key)) {</span> <span class="cstat-no" title="statement not covered" > delete extra_params[key];</span> } } &nbsp; <span class="cstat-no" title="statement not covered" > if ((method == "POST" || method == "PUT") &amp;&amp; (post_body == null &amp;&amp; extra_params != null)) {</span> // Fix the mismatch between the output of querystring.stringify() and this._encodeData() <span class="cstat-no" title="statement not covered" > post_body = querystring.stringify(extra_params)</span> .replace(/\!/g, "%21") .replace(/\'/g, "%27") .replace(/\(/g, "%28") .replace(/\)/g, "%29") .replace(/\*/g, "%2A"); } &nbsp; <span class="cstat-no" title="statement not covered" > if (post_body) {</span> <span class="cstat-no" title="statement not covered" > if (Buffer.isBuffer(post_body)) {</span> <span class="cstat-no" title="statement not covered" > headers["Content-length"] = post_body.length;</span> } else { <span class="cstat-no" title="statement not covered" > headers["Content-length"] = Buffer.byteLength(post_body);</span> } <span class="cstat-no" title="statement not covered" > headers["Content-Type"] = post_content_type;</span> } else { <span class="cstat-no" title="statement not covered" > headers["Content-length"] = 0;</span> } &nbsp; <span class="cstat-no" title="statement not covered" > var path;</span> <span class="cstat-no" title="statement not covered" > if (!parsedUrl.pathname || parsedUrl.pathname === "") <span class="cstat-no" title="statement not covered" >parsedUrl.pathname = "/";</span></span> <span class="cstat-no" title="statement not covered" > if (parsedUrl.query) <span class="cstat-no" title="statement not covered" >path = parsedUrl.pathname + "?" + parsedUrl.query;</span></span> else <span class="cstat-no" title="statement not covered" >path = parsedUrl.pathname;</span> &nbsp; <span class="cstat-no" title="statement not covered" > var request;</span> <span class="cstat-no" title="statement not covered" > if (parsedUrl.protocol == "https:") {</span> <span class="cstat-no" title="statement not covered" > request = this._createClient(parsedUrl.port, parsedUrl.hostname, method, path, headers, true);</span> } else { <span class="cstat-no" title="statement not covered" > request = this._createClient(parsedUrl.port, parsedUrl.hostname, method, path, headers);</span> } &nbsp; <span class="cstat-no" title="statement not covered" > var clientOptions = this._clientOptions;</span> <span class="cstat-no" title="statement not covered" > if (callback) {</span> <span class="cstat-no" title="statement not covered" > var data = "";</span> <span class="cstat-no" title="statement not covered" > var self = this;</span> &nbsp; // Some hosts *cough* google appear to close the connection early / send no content-length header // allow this behaviour. <span class="cstat-no" title="statement not covered" > var allowEarlyClose = false; </span>//OAuthUtils.isAnEarlyCloseHost(parsedUrl.hostname); <span class="cstat-no" title="statement not covered" > var callbackCalled = false;</span> <span class="cstat-no" title="statement not covered" > var passBackControl = <span class="fstat-no" title="function not covered" >function(response) {</span></span> <span class="cstat-no" title="statement not covered" > if (!callbackCalled) {</span> <span class="cstat-no" title="statement not covered" > callbackCalled = true;</span> <span class="cstat-no" title="statement not covered" > if (response.statusCode &gt;= 200 &amp;&amp; response.statusCode &lt;= 299) {</span> <span class="cstat-no" title="statement not covered" > callback(null, data, response);</span> } else { // Follow 301 or 302 redirects with Location HTTP header <span class="cstat-no" title="statement not covered" > if ((response.statusCode == 301 || response.statusCode == 302) &amp;&amp; clientOptions.followRedirects &amp;&amp; response.headers &amp;&amp; response.headers.location) {</span> <span class="cstat-no" title="statement not covered" > self._performSecureRequest(oauth_token, oauth_token_secret, method, response.headers.location, extra_params, post_body, post_content_type, callback);</span> } else { <span class="cstat-no" title="statement not covered" > callback({</span> statusCode: response.statusCode, data: data }, data, response); } } } } &nbsp; <span class="cstat-no" title="statement not covered" > request.on('response', <span class="fstat-no" title="function not covered" >function(response) {</span></span> <span class="cstat-no" title="statement not covered" > response.setEncoding('utf8');</span> <span class="cstat-no" title="statement not covered" > response.on('data', <span class="fstat-no" title="function not covered" >function(chunk) {</span></span> <span class="cstat-no" title="statement not covered" > data += chunk;</span> }); <span class="cstat-no" title="statement not covered" > response.on('end', <span class="fstat-no" title="function not covered" >function() {</span></span> <span class="cstat-no" title="statement not covered" > passBackControl(response);</span> }); <span class="cstat-no" title="statement not covered" > response.on('close', <span class="fstat-no" title="function not covered" >function() {</span></span> <span class="cstat-no" title="statement not covered" > if (allowEarlyClose) {</span> <span class="cstat-no" title="statement not covered" > passBackControl(response);</span> } }); }); &nbsp; <span class="cstat-no" title="statement not covered" > request.on("error", <span class="fstat-no" title="function not covered" >function(err) {</span></span> <span class="cstat-no" title="statement not covered" > if (!callbackCalled) {</span> <span class="cstat-no" title="statement not covered" > callbackCalled = true;</span> <span class="cstat-no" title="statement not covered" > callback(err)</span> } }); &nbsp; <span class="cstat-no" title="statement not covered" > if ((method === "POST" || method === "PUT") &amp;&amp; post_body != null &amp;&amp; post_body !== "") {</span> <span class="cstat-no" title="statement not covered" > request.write(post_body);</span> } <span class="cstat-no" title="statement not covered" > request.end();</span> } else { <span class="cstat-no" title="statement not covered" > if ((method === "POST" || method === "PUT") &amp;&amp; post_body != null &amp;&amp; post_body !== "") {</span> <span class="cstat-no" title="statement not covered" > request.write(post_body);</span> } <span class="cstat-no" title="statement not covered" > return request;</span> } /* jshint shadow: false, sub: false, eqnull: false */ <span class="cstat-no" title="statement not covered" > return;</span> } &nbsp; /** * Implement this so that we can send the callback... This doesn't seem to be * working right for the oauth module... */ Strategy.prototype.userAuthorizationParams = function(options) { return { oauth_callback: this._callbackURL } } &nbsp; // retrieve a profile-related object asynchronously and yield its body Strategy.prototype._retrieve = function(oauth, url, callback) { process.nextTick(function() { request.get(url, { oauth: oauth, json: true }, function(err, res, body) { if (err) { console.error(err) return callback(new InternalOAuthError('failed to fetch user profile', err)) } if (res.statusCode &gt; 299) { err = new InternalOAuthError('error ' + res.statusCode + ' while fetching user profile: ' + body) err.statusCode = res.statusCode console.error('failed to fetch user profile: %j', err) return callback(err) } &nbsp; if (!body) return callback(new InternalOAuthError('Fellowship One returned invalid reply object %s', body)) &nbsp; callback(null, body) }) }) } &nbsp; // transform an array of [ {person:...}, {communications:...}] into a profile Strategy.prototype.transform = function(err, items, done) { if (err) return done(err) &nbsp; if (!items[0].person) return done(new InternalOAuthError('Fellowship One returned invalid reply object %s', items[0])) <span class="missing-if-branch" title="if path not taken" >I</span>if (!items[1].communications) <span class="cstat-no" title="statement not covered" >return done(new InternalOAuthError('Fellowship One returned invalid reply object %s', items[1]))</span> &nbsp; var user = items[0].person var profile = {} profile.id = Number(user['@id']) profile.uri = user['@uri'] profile.displayName = user.goesByName ? <span class="branch-0 cbranch-no" title="branch not covered" >user.goesByName </span>: user.firstName profile.fullName = profile.displayName + ' ' + user.lastName &nbsp; var communication = items[1].communications.communication || <span class="branch-1 cbranch-no" title="branch not covered" >[]</span> &nbsp; var emails = communication.reduce(function(memo, comm) { <span class="missing-if-branch" title="else path not taken" >E</span>if (comm.communicationGeneralType === 'Email') memo.push({ value: comm.communicationValue, type: comm.communicationType.name, preferred: comm.preferred === "true" }) return memo }, []) &nbsp; var email = emails.reduce(function(memo, email) { <span class="missing-if-branch" title="if path not taken" >I</span>if (email.preferred) <span class="cstat-no" title="statement not covered" >return email</span> else <span class="missing-if-branch" title="if path not taken" >I</span>if (memo) <span class="cstat-no" title="statement not covered" >return memo</span> else return email }, undefined) <span class="missing-if-branch" title="else path not taken" >E</span>if (email &amp;&amp; email.value) profile.email = email.value &nbsp; done(null, profile) } &nbsp; /** * Retrieve user profile from Fellowship One. * * This function constructs a normalized profile, with the following properties: * * - `id` * - `displayName` * - `email` * * @param {String} token * @param {String} tokenSecret * @param {Object} params - this should have a userURL property, injected by the _oauth.getOAuthAccessToken call * @param {Function} done * @api protected */ Strategy.prototype.userProfile = function(token, tokenSecret, params, done) { if (!params || !params.userURL) return done(null, {}) &nbsp; var oauth = { consumer_key: this.options.consumerKey, consumer_secret: this.options.consumerSecret, token: token, token_secret: tokenSecret } &nbsp; // turn the person and communications record into a profile async.map([params.userURL, params.userURL + '/Communications'], this._retrieve.bind(this, oauth), (function(err, items) { this.transform(err, items, done) }).bind(this)) } &nbsp; /** * Expose `Strategy`. */ module.exports = Strategy; &nbsp;</pre></td></tr> </table></pre> </div> <div class="footer"> <div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jul 13 2014 21:01:01 GMT-0400 (EDT)</div> </div> <script src="../prettify.js"></script> <script src="https://yui-s.yahooapis.com/3.6.0/build/yui/yui-min.js"></script> <script> YUI().use('datatable', function (Y) { var formatters = { pct: function (o) { o.className += o.record.get('classes')[o.column.key]; try { return o.value.toFixed(2) + '%'; } catch (ex) { return o.value + '%'; } }, html: function (o) { o.className += o.record.get('classes')[o.column.key]; return o.record.get(o.column.key + '_html'); } }, defaultFormatter = function (o) { o.className += o.record.get('classes')[o.column.key]; return o.value; }; function getColumns(theadNode) { var colNodes = theadNode.all('tr th'), cols = [], col; colNodes.each(function (colNode) { col = { key: colNode.getAttribute('data-col'), label: colNode.get('innerHTML') || ' ', sortable: !colNode.getAttribute('data-nosort'), className: colNode.getAttribute('class'), type: colNode.getAttribute('data-type'), allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html' }; col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter; cols.push(col); }); return cols; } function getRowData(trNode, cols) { var tdNodes = trNode.all('td'), i, row = { classes: {} }, node, name; for (i = 0; i < cols.length; i += 1) { name = cols[i].key; node = tdNodes.item(i); row[name] = node.getAttribute('data-value') || node.get('innerHTML'); row[name + '_html'] = node.get('innerHTML'); row.classes[name] = node.getAttribute('class'); //Y.log('Name: ' + name + '; Value: ' + row[name]); if (cols[i].type === 'number') { row[name] = row[name] * 1; } } //Y.log(row); return row; } function getData(tbodyNode, cols) { var data = []; tbodyNode.all('tr').each(function (trNode) { data.push(getRowData(trNode, cols)); }); return data; } function replaceTable(node) { if (!node) { return; } var cols = getColumns(node.one('thead')), data = getData(node.one('tbody'), cols), table, parent = node.get('parentNode'); table = new Y.DataTable({ columns: cols, data: data, sortBy: 'file' }); parent.set('innerHTML', ''); table.render(parent); } Y.on('domready', function () { replaceTable(Y.one('div.coverage-summary table')); if (typeof prettyPrint === 'function') { prettyPrint(); } }); }); </script> </body> </html>