This repository was archived by the owner on Jun 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathconfig.html
More file actions
825 lines (710 loc) · 60.1 KB
/
config.html
File metadata and controls
825 lines (710 loc) · 60.1 KB
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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Configuration — Stormpath Java Servlet Plugin 1.5.4 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/theme_overrides.css" type="text/css" />
<link rel="author" title="About these documents"
href="about.html"/>
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="Stormpath Java Servlet Plugin 1.5.4 documentation" href="index.html"/>
<link rel="next" title="Registration" href="registration.html"/>
<link rel="prev" title="Quickstart" href="quickstart.html"/>
<script src="_static/js/modernizr.min.js"></script>
<script src="https://cdn.optimizely.com/js/225847041.js"></script>
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '986262161469311');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=986262161469311&ev=PageView&noscript=1"
/></noscript>
</head>
<body class="wy-body-for-nav" role="document">
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-NQZZFW"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-NQZZFW');</script>
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> Stormpath Java Servlet Plugin
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="about.html">About</a><ul>
<li class="toctree-l2"><a class="reference internal" href="about.html#what-is-stormpath">What is Stormpath?</a></li>
<li class="toctree-l2"><a class="reference internal" href="about.html#what-is-the-project">What is the Stormpath Java Servlet Plugin?</a></li>
<li class="toctree-l2"><a class="reference internal" href="about.html#who-should-use-stormpath">Who should use Stormpath?</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart</a><ul>
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#get-an-api-key">Get an API Key</a></li>
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#add-the-project">Add the Stormpath Java Servlet Plugin</a></li>
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#try-it">Try it!</a><ul>
<li class="toctree-l3"><a class="reference internal" href="quickstart.html#any-problems">Any Problems?</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="quickstart.html#next-steps">Next Steps</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Configuration</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#no-config">No Config?</a></li>
<li class="toctree-l2"><a class="reference internal" href="#web-xml">web.xml</a></li>
<li class="toctree-l2"><a class="reference internal" href="#stormpath-properties">stormpath.properties</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#property-locations">Property Locations</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#plugin-web-stormpath-properties">1. Plugin web.stormpath.properties</a></li>
<li class="toctree-l4"><a class="reference internal" href="#classpath-stormpath-properties">2. classpath:stormpath.properties</a></li>
<li class="toctree-l4"><a class="reference internal" href="#web-inf-stormpath-properties">3. /WEB-INF/stormpath.properties</a></li>
<li class="toctree-l4"><a class="reference internal" href="#servlet-context-parameters">4. Servlet Context Parameters</a></li>
<li class="toctree-l4"><a class="reference internal" href="#environment-variables">5. Environment Variables</a></li>
<li class="toctree-l4"><a class="reference internal" href="#jvm-system-properties">6. JVM System Properties</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#security-considerations-passwords-and-secret-values">Security Considerations: Passwords and secret values</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#stormpath-client">Stormpath Client</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#api-key">API Key</a></li>
<li class="toctree-l3"><a class="reference internal" href="#http-proxy">HTTP Proxy</a></li>
<li class="toctree-l3"><a class="reference internal" href="#authentication-scheme">Authentication Scheme</a></li>
<li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#stormpath-application">Stormpath Application</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id2">Usage</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#filters">Filters</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#default-filters">Default Filters</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#uris">URIs</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#uri-evaluation-priority">URI Evaluation Priority</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="registration.html">Registration</a><ul>
<li class="toctree-l2"><a class="reference internal" href="registration.html#overview">Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="registration.html#configuration">Configuration</a><ul>
<li class="toctree-l3"><a class="reference internal" href="registration.html#enabled">Enabled</a></li>
<li class="toctree-l3"><a class="reference internal" href="registration.html#uri">URI</a></li>
<li class="toctree-l3"><a class="reference internal" href="registration.html#next-uri">Next URI</a><ul>
<li class="toctree-l4"><a class="reference internal" href="registration.html#next-query-parameter">Next Query Parameter</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="registration.html#autologin">AutoLogin</a></li>
<li class="toctree-l3"><a class="reference internal" href="registration.html#form-fields">Form Fields</a><ul>
<li class="toctree-l4"><a class="reference internal" href="registration.html#form-field-definitions">Form Field Definitions</a></li>
<li class="toctree-l4"><a class="reference internal" href="registration.html#standard-form-fields">Standard Form Fields</a></li>
<li class="toctree-l4"><a class="reference internal" href="registration.html#custom-form-fields">Custom Form Fields</a></li>
<li class="toctree-l4"><a class="reference internal" href="registration.html#optional-form-fields">Optional Form Fields</a></li>
<li class="toctree-l4"><a class="reference internal" href="registration.html#disabling-form-fields">Disabling Form Fields</a></li>
<li class="toctree-l4"><a class="reference internal" href="registration.html#form-field-order">Form Field Order</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="registration.html#password-strength">Password Strength</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="registration.html#email-verification">Email Verification</a><ul>
<li class="toctree-l3"><a class="reference internal" href="registration.html#try-it">Try it!</a></li>
<li class="toctree-l3"><a class="reference internal" href="registration.html#verify-link-base-url">Verify Link Base URL</a></li>
<li class="toctree-l3"><a class="reference internal" href="registration.html#verify-next-uri">Verify Next URI</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="registration.html#internationalization-i18n">Internationalization (i18n)</a></li>
<li class="toctree-l2"><a class="reference internal" href="registration.html#pre-register-handler">Pre Register Handler</a></li>
<li class="toctree-l2"><a class="reference internal" href="registration.html#post-register-handler">Post Register Handler</a></li>
<li class="toctree-l2"><a class="reference internal" href="registration.html#events">Events</a><ul>
<li class="toctree-l3"><a class="reference internal" href="registration.html#registered-account">Registered Account</a></li>
<li class="toctree-l3"><a class="reference internal" href="registration.html#verified-account">Verified Account</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="login.html">Login</a><ul>
<li class="toctree-l2"><a class="reference internal" href="login.html#overview">Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="login.html#security-notice">Security Notice</a></li>
<li class="toctree-l2"><a class="reference internal" href="login.html#uri">URI</a><ul>
<li class="toctree-l3"><a class="reference internal" href="login.html#next-query-parameter">Next Query Parameter</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="login.html#next-uri">Next URI</a></li>
<li class="toctree-l2"><a class="reference internal" href="login.html#internationalization-i18n">Internationalization (i18n)</a></li>
<li class="toctree-l2"><a class="reference internal" href="login.html#pre-login-handler">Pre Login Handler</a></li>
<li class="toctree-l2"><a class="reference internal" href="login.html#post-login-handler">Post Login Handler</a></li>
<li class="toctree-l2"><a class="reference internal" href="login.html#events">Events</a></li>
<li class="toctree-l2"><a class="reference internal" href="login.html#authentication-state">Authentication State</a><ul>
<li class="toctree-l3"><a class="reference internal" href="login.html#saving-authentication-state">Saving Authentication State</a></li>
<li class="toctree-l3"><a class="reference internal" href="login.html#cookie-storage">Cookie Storage</a><ul>
<li class="toctree-l4"><a class="reference internal" href="login.html#cookie-config">Cookie Config</a></li>
<li class="toctree-l4"><a class="reference internal" href="login.html#jwt-creation">JWT Creation</a></li>
<li class="toctree-l4"><a class="reference internal" href="login.html#disabling-cookie-storage">Disabling Cookie Storage</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="login.html#custom-savers">Custom Savers</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="social.html">Social Login</a><ul>
<li class="toctree-l2"><a class="reference internal" href="social.html#facebook-login">Facebook Login</a><ul>
<li class="toctree-l3"><a class="reference internal" href="social.html#create-a-facebook-app">Create a Facebook App</a></li>
<li class="toctree-l3"><a class="reference internal" href="social.html#specify-allowed-urls">Specify Allowed URLs</a></li>
<li class="toctree-l3"><a class="reference internal" href="social.html#create-a-facebook-directory">Create a Facebook Directory</a></li>
<li class="toctree-l3"><a class="reference internal" href="social.html#test-it-out">Test it Out</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="social.html#google-login">Google Login</a><ul>
<li class="toctree-l3"><a class="reference internal" href="social.html#create-a-google-project">Create a Google Project</a></li>
<li class="toctree-l3"><a class="reference internal" href="social.html#enable-google-login">Enable Google Login</a></li>
<li class="toctree-l3"><a class="reference internal" href="social.html#create-oauth-credentials">Create OAuth Credentials</a></li>
<li class="toctree-l3"><a class="reference internal" href="social.html#create-a-google-directory">Create a Google Directory</a></li>
<li class="toctree-l3"><a class="reference internal" href="social.html#id1">Test it Out</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="social.html#linkedin-login">LinkedIn Login</a><ul>
<li class="toctree-l3"><a class="reference internal" href="social.html#create-a-linkedin-application">Create a LinkedIn Application</a></li>
<li class="toctree-l3"><a class="reference internal" href="social.html#enable-linkedin-permissions">Enable LinkedIn Permissions</a></li>
<li class="toctree-l3"><a class="reference internal" href="social.html#create-a-linkedin-directory">Create a LinkedIn Directory</a></li>
<li class="toctree-l3"><a class="reference internal" href="social.html#id2">Test it Out</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="social.html#json-api">JSON API</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="forgot-password.html">Forgot Password</a><ul>
<li class="toctree-l2"><a class="reference internal" href="forgot-password.html#overview">Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="forgot-password.html#configure-the-workflow">Configure the Workflow</a></li>
<li class="toctree-l2"><a class="reference internal" href="forgot-password.html#try-it">Try it!</a></li>
<li class="toctree-l2"><a class="reference internal" href="forgot-password.html#forgot-uri">Forgot URI</a></li>
<li class="toctree-l2"><a class="reference internal" href="forgot-password.html#forgot-next-uri">Forgot Next URI</a></li>
<li class="toctree-l2"><a class="reference internal" href="forgot-password.html#change-password-uri">Change Password URI</a></li>
<li class="toctree-l2"><a class="reference internal" href="forgot-password.html#change-password-next-uri">Change Password Next URI</a></li>
<li class="toctree-l2"><a class="reference internal" href="forgot-password.html#i18n">i18n</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="logout.html">Logout</a><ul>
<li class="toctree-l2"><a class="reference internal" href="logout.html#uri">URI</a><ul>
<li class="toctree-l3"><a class="reference internal" href="logout.html#next-query-parameter">Next Query Parameter</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="logout.html#next-uri">Next URI</a></li>
<li class="toctree-l2"><a class="reference internal" href="logout.html#events">Events</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="request-authentication.html">HTTP Request Authentication</a><ul>
<li class="toctree-l2"><a class="reference internal" href="request-authentication.html#http-basic-authentication">HTTP Basic Authentication</a></li>
<li class="toctree-l2"><a class="reference internal" href="request-authentication.html#token-authentication">Token Authentication</a><ul>
<li class="toctree-l3"><a class="reference internal" href="request-authentication.html#get-a-token">Get a Token</a><ul>
<li class="toctree-l4"><a class="reference internal" href="request-authentication.html#curl">cURL</a></li>
<li class="toctree-l4"><a class="reference internal" href="request-authentication.html#html-form-and-ajax">HTML Form and AJAX</a></li>
<li class="toctree-l4"><a class="reference internal" href="request-authentication.html#origin-or-referer-required">Origin or Referer Required</a></li>
<li class="toctree-l4"><a class="reference internal" href="request-authentication.html#https-required">HTTPS Required</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="request-authentication.html#api-key-authentication">API Key Authentication</a><ul>
<li class="toctree-l3"><a class="reference internal" href="request-authentication.html#determining-api-key-authentication">Determining API Key Authentication</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="request.html">Request Context</a><ul>
<li class="toctree-l2"><a class="reference internal" href="request.html#current-user-account">Current User Account</a><ul>
<li class="toctree-l3"><a class="reference internal" href="request.html#account-resolver">Account Resolver</a></li>
<li class="toctree-l3"><a class="reference internal" href="request.html#request-attributes">Request Attributes</a><ul>
<li class="toctree-l4"><a class="reference internal" href="request.html#request-attribute-names">Request Attribute Names</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="request.html#http-servlet-request-api">HTTP Servlet Request API</a><ul>
<li class="toctree-l4"><a class="reference internal" href="request.html#httpservletrequest-getremoteuser">HttpServletRequest getRemoteUser()</a></li>
<li class="toctree-l4"><a class="reference internal" href="request.html#httpservletrequest-getuserprincipal">HttpServletRequest getUserPrincipal()</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="request.html#stormpath-application">Stormpath Application</a><ul>
<li class="toctree-l3"><a class="reference internal" href="request.html#application-resolver">Application Resolver</a></li>
<li class="toctree-l3"><a class="reference internal" href="request.html#id2">Request Attributes</a><ul>
<li class="toctree-l4"><a class="reference internal" href="request.html#default-request-attribute-name">Default Request Attribute Name</a></li>
<li class="toctree-l4"><a class="reference internal" href="request.html#custom-request-attribute-names">Custom Request Attribute Names</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="request.html#stormpath-client">Stormpath Client</a><ul>
<li class="toctree-l3"><a class="reference internal" href="request.html#client-resolver">Client Resolver</a></li>
<li class="toctree-l3"><a class="reference internal" href="request.html#id3">Request Attributes</a><ul>
<li class="toctree-l4"><a class="reference internal" href="request.html#id4">Default Request Attribute Name</a></li>
<li class="toctree-l4"><a class="reference internal" href="request.html#id5">Custom Request Attribute Names</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="access-control.html">Access Control</a><ul>
<li class="toctree-l2"><a class="reference internal" href="access-control.html#authentication">Authentication</a><ul>
<li class="toctree-l3"><a class="reference internal" href="access-control.html#unauthenticatedhandler">UnauthenticatedHandler</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="access-control.html#exclusions">Exclusions</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="i18n.html">Internationalization (i18n)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="i18n.html#languages">Languages</a></li>
<li class="toctree-l2"><a class="reference internal" href="i18n.html#request-locale">Request Locale</a></li>
<li class="toctree-l2"><a class="reference internal" href="i18n.html#jsp-tag-library">JSP Tag Library</a></li>
<li class="toctree-l2"><a class="reference internal" href="i18n.html#i18n-properties">i18n.properties</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="events.html">Events</a><ul>
<li class="toctree-l2"><a class="reference internal" href="events.html#requesteventlistener">RequestEventListener</a></li>
<li class="toctree-l2"><a class="reference internal" href="events.html#id2">Events</a></li>
<li class="toctree-l2"><a class="reference internal" href="events.html#listener-best-practices">Listener Best Practices</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="caching.html">Caching</a><ul>
<li class="toctree-l2"><a class="reference internal" href="caching.html#in-process-cache">In-Process Cache</a></li>
<li class="toctree-l2"><a class="reference internal" href="caching.html#disable-caching">Disable Caching</a><ul>
<li class="toctree-l3"><a class="reference internal" href="caching.html#default-ttl">Default TTL</a></li>
<li class="toctree-l3"><a class="reference internal" href="caching.html#default-tti">Default TTI</a></li>
<li class="toctree-l3"><a class="reference internal" href="caching.html#cache-regions">Cache Regions</a></li>
<li class="toctree-l3"><a class="reference internal" href="caching.html#client-cache-regions">Client Cache Regions</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="caching.html#shared-cache">Shared Cache</a><ul>
<li class="toctree-l3"><a class="reference internal" href="caching.html#nonce-cache-region">Nonce Cache Region</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="idsite.html">ID Site</a><ul>
<li class="toctree-l2"><a class="reference internal" href="idsite.html#how-does-it-work">How Does It Work?</a></li>
<li class="toctree-l2"><a class="reference internal" href="idsite.html#enable-id-site">Enable ID Site</a></li>
<li class="toctree-l2"><a class="reference internal" href="idsite.html#configure-your-application">Configure Your Application</a></li>
<li class="toctree-l2"><a class="reference internal" href="idsite.html#try-it">Try It!</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="views.html">Custom Views</a><ul>
<li class="toctree-l2"><a class="reference internal" href="views.html#jsp-views">JSP Views</a></li>
<li class="toctree-l2"><a class="reference internal" href="views.html#css">CSS</a></li>
<li class="toctree-l2"><a class="reference internal" href="views.html#internationalization-i18n">Internationalization (i18n)</a></li>
<li class="toctree-l2"><a class="reference internal" href="views.html#change-a-default-view">Change a Default View</a></li>
<li class="toctree-l2"><a class="reference internal" href="views.html#view-template">View Template</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="appendix.html">Appendix</a><ul>
<li class="toctree-l2"><a class="reference internal" href="appendix/web-stormpath-properties.html">web.stormpath.properties</a></li>
<li class="toctree-l2"><a class="reference internal" href="appendix/i18n-properties.html">i18n.properties</a></li>
<li class="toctree-l2"><a class="reference internal" href="appendix/stormpath-css.html">stormpath.css</a></li>
<li class="toctree-l2"><a class="reference internal" href="appendix/change-password.html">/WEB-INF/jsp/stormpath/change-password.jsp</a></li>
<li class="toctree-l2"><a class="reference internal" href="appendix/forgot-password.html">/WEB-INF/jsp/stormpath/forgot-password.jsp</a></li>
<li class="toctree-l2"><a class="reference internal" href="appendix/login.html">/WEB-INF/jsp/stormpath/login.jsp</a></li>
<li class="toctree-l2"><a class="reference internal" href="appendix/register.html">/WEB-INF/jsp/stormpath/register.jsp</a></li>
<li class="toctree-l2"><a class="reference internal" href="appendix/verify.html">/WEB-INF/jsp/stormpath/verify.jsp</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Stormpath Java Servlet Plugin</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li>Configuration</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<blockquote>
<div></div></blockquote>
<div class="section" id="configuration">
<span id="config"></span><h1>Configuration<a class="headerlink" href="#configuration" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#no-config" id="id7">No Config?</a></li>
<li><a class="reference internal" href="#web-xml" id="id8">web.xml</a></li>
<li><a class="reference internal" href="#stormpath-properties" id="id9">stormpath.properties</a><ul>
<li><a class="reference internal" href="#property-locations" id="id10">Property Locations</a></li>
<li><a class="reference internal" href="#security-considerations-passwords-and-secret-values" id="id11">Security Considerations: Passwords and secret values</a></li>
</ul>
</li>
<li><a class="reference internal" href="#stormpath-client" id="id12">Stormpath Client</a><ul>
<li><a class="reference internal" href="#api-key" id="id13">API Key</a></li>
<li><a class="reference internal" href="#http-proxy" id="id14">HTTP Proxy</a></li>
<li><a class="reference internal" href="#authentication-scheme" id="id15">Authentication Scheme</a></li>
<li><a class="reference internal" href="#usage" id="id16">Usage</a></li>
</ul>
</li>
<li><a class="reference internal" href="#stormpath-application" id="id17">Stormpath Application</a><ul>
<li><a class="reference internal" href="#id2" id="id18">Usage</a></li>
</ul>
</li>
<li><a class="reference internal" href="#filters" id="id19">Filters</a><ul>
<li><a class="reference internal" href="#default-filters" id="id20">Default Filters</a></li>
</ul>
</li>
<li><a class="reference internal" href="#uris" id="id21">URIs</a><ul>
<li><a class="reference internal" href="#uri-evaluation-priority" id="id22">URI Evaluation Priority</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="no-config">
<h2><a class="toc-backref" href="#id7">No Config?</a><a class="headerlink" href="#no-config" title="Permalink to this headline">¶</a></h2>
<p>Refreshingly, the Stormpath Java Servlet Plugin doesn’t require any configuration at all if the following conditions apply:</p>
<ol class="arabic simple">
<li>You added the <code class="docutils literal"><span class="pre">stormpath-servlet-plugin-1.5.4.jar</span></code> and its transitive dependencies to your application’s classpath. This happens automatically if you use a Maven-compatible build tool like Maven or Gradle to <a class="reference internal" href="quickstart.html#dependency-jar"><span class="std std-ref">specify the Stormpath dependency</span></a> in your project build configuration.</li>
<li>Your application can read the <code class="docutils literal"><span class="pre">$HOME/.stormpath/apiKey.properties</span></code> file <a class="reference internal" href="quickstart.html#get-api-key"><span class="std std-ref">mentioned in the Quickstart</span></a>.</li>
<li>You have only one <code class="docutils literal"><span class="pre">Application</span></code> record registered within Stormpath.</li>
</ol>
<p>If all of these conditions cannot be met, then you will have to specify some minimal configuration (but not much!) as described below.</p>
</div>
<div class="section" id="web-xml">
<h2><a class="toc-backref" href="#id8">web.xml</a><a class="headerlink" href="#web-xml" title="Permalink to this headline">¶</a></h2>
<p>Most plugin users do not need to modify the web application <code class="docutils literal"><span class="pre">/WEB-INF/web.xml</span></code> file to enable the plugin - just adding the plugin .jar to your web application’s <code class="docutils literal"><span class="pre">lib</span></code> directory is usually sufficient.</p>
<p>However, some applications might experience a filter chain conflict that causes problems.</p>
<p>At application startup, the Stormpath Java Servlet Plugin automatically enables a <code class="docutils literal"><span class="pre">StormpathFilter</span></code> to handle various request flows. If your web application uses frameworks that make heavy use of servlet filters, like Spring MVC or Apache Shiro, these existing filters might cause an ordering conflict with the <code class="docutils literal"><span class="pre">StormpathFilter</span></code>.</p>
<p>If you are experiencing problems after adding <code class="docutils literal"><span class="pre">stormpath-servlet-plugin-1.5.4.jar</span></code> to your web app’s classpath, you’ll need to explicitly specify where the <code class="docutils literal"><span class="pre">StormpathFilter</span></code> should reside in your application’s filter chain. Luckily the fix is really easy:</p>
<p>Simply specify the following XML chunk in <code class="docutils literal"><span class="pre">/WEB-INF/web.xml</span></code> relative to other filter mappings that are already enabled in your application:</p>
<div class="highlight-xml"><div class="highlight"><pre><span></span><span class="nt"><filter-mapping></span>
<span class="nt"><filter-name></span>StormpathFilter<span class="nt"></filter-name></span>
<span class="nt"><url-pattern></span>/*<span class="nt"></url-pattern></span>
<span class="nt"></filter-mapping></span>
</pre></div>
</div>
<p>It is often easiest to specifying this at or near the top of your other filter mappings. The <code class="docutils literal"><span class="pre">StormpathFilter</span></code> will ignore all filtered requests that do not match recognized URL rules, allowing other frameworks to filter requests as necessary.</p>
</div>
<div class="section" id="stormpath-properties">
<h2><a class="toc-backref" href="#id9">stormpath.properties</a><a class="headerlink" href="#stormpath-properties" title="Permalink to this headline">¶</a></h2>
<p>If you need to customize behavior, the Stormpath Java Servlet Plugin uses a very simple <code class="docutils literal"><span class="pre">.properties</span></code> based configuration format and supports a convenient override mechanism using various property definition locations.</p>
<p>All stormpath configuration properties are prefixed with <code class="docutils literal"><span class="pre">stormpath.</span></code> and take the following form (for example)</p>
<div class="highlight-properties"><div class="highlight"><pre><span></span><span class="na">stormpath.some.property.name</span> <span class="o">=</span> <span class="s">aValue</span>
<span class="na">stormpath.another.property.name</span> <span class="o">=</span> <span class="s">anotherValue</span>
</pre></div>
</div>
<p>etc.</p>
<div class="section" id="property-locations">
<span id="stormpath-properties-locations"></span><h3><a class="toc-backref" href="#id10">Property Locations</a><a class="headerlink" href="#property-locations" title="Permalink to this headline">¶</a></h3>
<p>You can define stormpath property values in a number of locations. This allows you to define a core set of properties in a primary configuration file and override values as necessary using other locations.</p>
<p>Configuration property values are read from the following locations, <em>in order</em>. Values discovered in locations later (further down in the list) will automatically override values found in previous locations:</p>
<div class="contents local topic" id="id1">
<ul class="simple">
<li><a class="reference internal" href="#plugin-web-stormpath-properties" id="id23">1. Plugin web.stormpath.properties</a></li>
<li><a class="reference internal" href="#classpath-stormpath-properties" id="id24">2. classpath:stormpath.properties</a></li>
<li><a class="reference internal" href="#web-inf-stormpath-properties" id="id25">3. /WEB-INF/stormpath.properties</a></li>
<li><a class="reference internal" href="#servlet-context-parameters" id="id26">4. Servlet Context Parameters</a></li>
<li><a class="reference internal" href="#environment-variables" id="id27">5. Environment Variables</a></li>
<li><a class="reference internal" href="#jvm-system-properties" id="id28">6. JVM System Properties</a></li>
</ul>
</div>
<p>If you’re just starting out, we recommend that your configuration be specified in <code class="docutils literal"><span class="pre">/WEB-INF/stormpath.properties</span></code> and you use environment variables to specify password or secret values (e.g. for production environments).</p>
<p>Defining properties in these locations is covered more in detail next.</p>
<div class="section" id="plugin-web-stormpath-properties">
<h4><a class="toc-backref" href="#id23">1. Plugin web.stormpath.properties</a><a class="headerlink" href="#plugin-web-stormpath-properties" title="Permalink to this headline">¶</a></h4>
<p>This file resides in the stormpath-servlet-plugin-1.5.4.jar at:</p>
<blockquote>
<div><code class="docutils literal"><span class="pre">/com/stormpath/sdk/servlet/config/web.stormpath.properties</span></code></div></blockquote>
<p>It includes all of the plugin’s default configuration and is not modifiable. The default values within can be overridden by specifying properties in locations read later during the startup process.</p>
</div>
<div class="section" id="classpath-stormpath-properties">
<h4><a class="toc-backref" href="#id24">2. classpath:stormpath.properties</a><a class="headerlink" href="#classpath-stormpath-properties" title="Permalink to this headline">¶</a></h4>
<p>If a <code class="docutils literal"><span class="pre">stormpath.properties</span></code> file exists at the root of your web application’s classpath (typically in <code class="docutils literal"><span class="pre">/WEB-INF/classes</span></code> or at the root of one of your .jar files in <code class="docutils literal"><span class="pre">/WEB-INF/lib</span></code>), <code class="docutils literal"><span class="pre">stormpath.*</span></code> properties will be read from that file and override any identically-named properties discovered previously.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Because this is not a web-specific location, it is only recommended to use this location if you wish to share stormpath properties configuration across multiple projects in a ‘resource .jar’ that is used in such projects.</p>
</div>
</div>
<div class="section" id="web-inf-stormpath-properties">
<h4><a class="toc-backref" href="#id25">3. /WEB-INF/stormpath.properties</a><a class="headerlink" href="#web-inf-stormpath-properties" title="Permalink to this headline">¶</a></h4>
<p>If a file <code class="docutils literal"><span class="pre">/WEB-INF/stormpath.properties</span></code> exists in your web application, properties will be read from this file and override any identically-named properties discovered in previous locations.</p>
<div class="admonition tip">
<p class="first admonition-title">Tip</p>
<p class="last">This is the recommended primary configuration location for most web applications.</p>
</div>
</div>
<div class="section" id="servlet-context-parameters">
<h4><a class="toc-backref" href="#id26">4. Servlet Context Parameters</a><a class="headerlink" href="#servlet-context-parameters" title="Permalink to this headline">¶</a></h4>
<p>If you define <code class="docutils literal"><span class="pre">stormpath.*</span></code> servlet context parameters in your web application’s <code class="docutils literal"><span class="pre">/WEB-INF/web.xml</span></code> file, they will override any identically-named properties discovered in previous locations. For example:</p>
<div class="highlight-xml"><div class="highlight"><pre><span></span><span class="nt"><context-param></span>
<span class="nt"><param-name></span>stormpath.properties<span class="nt"></param-name></span>
<span class="nt"><param-value></span><span class="cp"><![CDATA[</span>
<span class="cp"> stormpath.foo.bar = myValue</span>
<span class="cp"> stormpath.other.prop = another value</span>
<span class="cp"> ]]></span><span class="nt"></param-value></span>
<span class="nt"></context-param></span>
</pre></div>
</div>
</div>
<div class="section" id="environment-variables">
<h4><a class="toc-backref" href="#id27">5. Environment Variables</a><a class="headerlink" href="#environment-variables" title="Permalink to this headline">¶</a></h4>
<p>You may use Environment Variables to specify or override your application’s <code class="docutils literal"><span class="pre">stormpath.*</span></code> properties using an all uppercase + underscore convention.</p>
<p>For example, let’s assume there is a property named <code class="docutils literal"><span class="pre">stormpath.foo.bar</span></code> that you would might specify in a file:</p>
<div class="highlight-properties"><div class="highlight"><pre><span></span><span class="na">stormpath.foo.bar</span> <span class="o">=</span> <span class="s">myValue</span>
</pre></div>
</div>
<p>If you wanted to specify this property as an environment variable, you would change all characters to uppercase and replace all period characters <code class="docutils literal"><span class="pre">.</span></code> with underscores <code class="docutils literal"><span class="pre">_</span></code>. The above example then becomes:</p>
<p><code class="docutils literal"><span class="pre">STORMPATH_FOO_BAR=myValue</span></code></p>
<p>For example, using the bash shell on a *nix operating system:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ <span class="nb">export</span> <span class="nv">STORMPATH_FOO_BAR</span><span class="o">=</span>myValue
</pre></div>
</div>
</div>
<div class="section" id="jvm-system-properties">
<h4><a class="toc-backref" href="#id28">6. JVM System Properties</a><a class="headerlink" href="#jvm-system-properties" title="Permalink to this headline">¶</a></h4>
<p>If you define <code class="docutils literal"><span class="pre">stormpath.*</span></code> system properties (using <code class="docutils literal"><span class="pre">-D</span></code> flags when starting the java process), they will override any identically-named properties discovered in previous locations. For example:</p>
<p><code class="docutils literal"><span class="pre">-Dstormpath.foo.bar=myValue</span></code></p>
</div>
</div>
<div class="section" id="security-considerations-passwords-and-secret-values">
<span id="property-security-considerations"></span><h3><a class="toc-backref" href="#id11">Security Considerations: Passwords and secret values</a><a class="headerlink" href="#security-considerations-passwords-and-secret-values" title="Permalink to this headline">¶</a></h3>
<p>It is <strong>strongly</strong> recommended that you do not specify the <code class="docutils literal"><span class="pre">stormpath.client.apiKey.secret</span></code> property - or any other password or secret property - in shared files such as <code class="docutils literal"><span class="pre">classpath:stormpath.properties</span></code>, <code class="docutils literal"><span class="pre">/WEB-INF/stormpath.properties</span></code>, or <code class="docutils literal"><span class="pre">web.xml</span></code>. These files are usually committed to version control (like git) and shared with other developers.</p>
<p>Because Stormpath API Keys are always assigned to an individual person, they should never be shared with or visible to anyone else, not even other co-workers or even Stormpath employees. Anyone that has your API Key id and secret can alter the data in your Stormpath tenant.</p>
<p>Also, it should also be noted that, while JVM System Properties are not usually visible to other developers, using System Properties for secrets and passwords can also be seen as a security risk: system property values are visible to anyone performing a process listing on a production machine (e.g. <code class="docutils literal"><span class="pre">ps</span> <span class="pre">aux</span> <span class="pre">|</span> <span class="pre">grep</span> <span class="pre">java</span></code>).</p>
<p>If you cannot rely on accessing the default <code class="docutils literal"><span class="pre">$HOME/.stormpath/apiKey.properties</span></code> file, environment variables or a different private local file (with restricted read permissions) is usually a safer alternative when defining passwords or secret values than shared files or JVM System Properties.</p>
</div>
</div>
<div class="section" id="stormpath-client">
<h2><a class="toc-backref" href="#id12">Stormpath Client</a><a class="headerlink" href="#stormpath-client" title="Permalink to this headline">¶</a></h2>
<p>The Stormpath Java Servlet Plugin depends on a Stormpath <code class="docutils literal"><span class="pre">Client</span></code> instance to communicate with Stormpath for most functionality. You may configure the client via <code class="docutils literal"><span class="pre">stormpath.*</span></code> properties as necessary.</p>
<div class="section" id="api-key">
<h3><a class="toc-backref" href="#id13">API Key</a><a class="headerlink" href="#api-key" title="Permalink to this headline">¶</a></h3>
<p>The API Key used by the SDK Client will be acquired from the following locations. Locations inspected later override previously discovered values.</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">STORMPATH_API_KEY_FILE</span></code> environment variable, which refers to the location of an api key properties file</li>
<li><code class="docutils literal"><span class="pre">$HOME/.stormpath/apiKey.properties</span></code> file</li>
<li>Any <code class="docutils literal"><span class="pre">stormpath.client.apiKey.id</span></code> value discovered from inspected <a class="reference internal" href="#stormpath-properties-locations"><span class="std std-ref">property locations</span></a></li>
<li>Any <code class="docutils literal"><span class="pre">stormpath.client.apiKey.secret</span></code> value discovered from inspected <a class="reference internal" href="#stormpath-properties-locations"><span class="std std-ref">property locations</span></a></li>
</ul>
<div class="admonition caution">
<p class="first admonition-title">Caution</p>
<p class="last">While <code class="docutils literal"><span class="pre">stormpath.client.apiKey.secret</span></code> can be configured as a property in a file, please be aware of the <a class="reference internal" href="#property-security-considerations"><span class="std std-ref">security considerations</span></a> of files shared with other people.</p>
</div>
</div>
<div class="section" id="http-proxy">
<h3><a class="toc-backref" href="#id14">HTTP Proxy</a><a class="headerlink" href="#http-proxy" title="Permalink to this headline">¶</a></h3>
<p>If your application requires communication to Stormpath go through an HTTP Proxy, you can set the following configuration properties as needed:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">stormpath.client.proxy.host</span></code>: Proxy server hostname or IP address, e.g. <code class="docutils literal"><span class="pre">proxy.mycompany.com</span></code> or <code class="docutils literal"><span class="pre">10.0.2.88</span></code>.</li>
<li><code class="docutils literal"><span class="pre">stormpath.client.proxy.port</span></code>: Proxy server port, for example <code class="docutils literal"><span class="pre">8888</span></code>.</li>
<li><code class="docutils literal"><span class="pre">stormpath.client.proxy.username</span></code>: Username to use when connecting to the proxy server. Only configure this property if proxy server username/password authentication is required.</li>
<li><code class="docutils literal"><span class="pre">stormpath.client.proxy.password</span></code>: Password to use when connecting to the proxy server. Only configure this property if proxy server username/password authentication is required, but <strong>note</strong>: it is strongly recommended that you don’t embed passwords in text files. You might want to specify this property as an environment variable, for example:</li>
</ul>
<blockquote>
<div><div class="highlight-bash"><div class="highlight"><pre><span></span><span class="nb">export</span> <span class="nv">STORMPATH_CLIENT_PROXY_PASSWORD</span><span class="o">=</span>your_proxy_server_password
</pre></div>
</div>
</div></blockquote>
</div>
<div class="section" id="authentication-scheme">
<h3><a class="toc-backref" href="#id15">Authentication Scheme</a><a class="headerlink" href="#authentication-scheme" title="Permalink to this headline">¶</a></h3>
<p>The Stormpath SDK Client communicates with Stormpath using a very secure <a class="reference external" href="http://en.wikipedia.org/wiki/Cryptographic_hash_function">cryptographic digest</a>-based authentication scheme.</p>
<p>If you deploy your application on Google App Engine however, you might experience some problems. You can change the scheme to use <code class="docutils literal"><span class="pre">basic</span></code> authentication by setting the following configuration property and value:</p>
<div class="highlight-properties"><div class="highlight"><pre><span></span><span class="na">stormpath.client.authenticationScheme</span> <span class="o">=</span> <span class="s">basic</span>
</pre></div>
</div>
<p>If your application is not deployed on Google App Engine, we recommend that you <em>do not</em> set this property.</p>
</div>
<div class="section" id="usage">
<h3><a class="toc-backref" href="#id16">Usage</a><a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h3>
<p>After application startup, you may access the Stormpath <code class="docutils literal"><span class="pre">Client</span></code> instance if desired using the <code class="docutils literal"><span class="pre">ClientResolver</span></code> and referencing the web application’s <code class="docutils literal"><span class="pre">ServletContext</span></code>:</p>
<div class="highlight-java"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">com.stormpath.sdk.servlet.client.ClientResolver</span><span class="o">;</span>
<span class="c1">//...</span>
<span class="n">Client</span> <span class="n">client</span> <span class="o">=</span> <span class="n">ClientResolver</span><span class="o">.</span><span class="na">INSTANCE</span><span class="o">.</span><span class="na">getClient</span><span class="o">(</span><span class="n">servletContext</span><span class="o">);</span>
</pre></div>
</div>
<p>You can also <a class="reference internal" href="request.html#request-sdk-client"><span class="std std-ref">access the client via a ServletRequest</span></a>.</p>
</div>
</div>
<div class="section" id="stormpath-application">
<h2><a class="toc-backref" href="#id17">Stormpath Application</a><a class="headerlink" href="#stormpath-application" title="Permalink to this headline">¶</a></h2>
<p>The Stormpath Java Servlet Plugin requires that your application correspond to a registered <code class="docutils literal"><span class="pre">Application</span></code> record within Stormpath.</p>
<p>If you only have one registered application with Stormpath, Stormpath Java Servlet Plugin will automatically query Stormpath at startup, find the <code class="docutils literal"><span class="pre">Application</span></code> and use it, and no configuration is necessary.</p>
<p>However, if you have more than one application registered with Stormpath, you must configure the <code class="docutils literal"><span class="pre">href</span></code> of the specific application to access by setting the following configuration property:</p>
<div class="highlight-properties"><div class="highlight"><pre><span></span><span class="na">stormpath.application.href</span> <span class="o">=</span> <span class="s">your_application_href_here</span>
</pre></div>
</div>
<p>You can find your application’s href in the <a class="reference external" href="https://api.stormpath.com">Stormpath Admin Console</a>:</p>
<ol class="arabic">
<li><p class="first">Click on the <code class="docutils literal"><span class="pre">Applications</span></code> tab and find your application in the list. Click on the Application’s name:</p>
<img alt="_images/console-applications-ann.png" src="_images/console-applications-ann.png" />
</li>
<li><p class="first">On the resulting <em>Application Details</em> page, the <strong>REST URL</strong> property value is your application’s <code class="docutils literal"><span class="pre">href</span></code>:</p>
<img alt="_images/console-application-href.png" src="_images/console-application-href.png" />
</li>
</ol>
<div class="section" id="id2">
<h3><a class="toc-backref" href="#id18">Usage</a><a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
<p>After application startup, you may access the <code class="docutils literal"><span class="pre">Application</span></code> instance if desired (for example, searching your application’s user accounts, creating groups, etc) using the <code class="docutils literal"><span class="pre">ApplicationResolver</span></code> and referencing the web application’s <code class="docutils literal"><span class="pre">ServletContext</span></code>:</p>
<div class="highlight-java"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">com.stormpath.sdk.servlet.application.ApplicationResolver</span><span class="o">;</span>
<span class="c1">//...</span>
<span class="n">Application</span> <span class="n">myApp</span> <span class="o">=</span> <span class="n">ApplicationResolver</span><span class="o">.</span><span class="na">INSTANCE</span><span class="o">.</span><span class="na">getApplication</span><span class="o">(</span><span class="n">servletContext</span><span class="o">);</span>
</pre></div>
</div>
<p>You can also <a class="reference internal" href="request.html#request-application"><span class="std std-ref">access the application via a ServletRequest</span></a>.</p>
</div>
</div>
<div class="section" id="filters">
<span id="id3"></span><h2><a class="toc-backref" href="#id19">Filters</a><a class="headerlink" href="#filters" title="Permalink to this headline">¶</a></h2>
<p>The Stormpath Java Servlet Plugin works largely by intercepting requests to certain URI paths in your application and then executing one or more servlet filters based on the URI being accessed.</p>
<p>All of the Servlet Filters needed by the plugin are already configured, but if you wanted to, you could define your own Servlet Filters (or even override the plugin’s defaults) as configuration properties via the following convention:</p>
<div class="highlight-properties"><div class="highlight"><pre><span></span><span class="na">stormpath.web.filters.FILTER_NAME</span> <span class="o">=</span> <span class="s">FULLY_QUALFIED_CLASS_NAME</span>
</pre></div>
</div>
<p>where:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">FILTER_NAME</span></code> is a unique String name of the filter.</li>
<li><code class="docutils literal"><span class="pre">FULLY_QUALIFIED_CLASS_NAME</span></code> is your <code class="docutils literal"><span class="pre">javax.servlet.Filter</span></code> implementation fully qualified class name, for example, <code class="docutils literal"><span class="pre">com.whatever.foo.MyFilter</span></code>.</li>
</ul>
<div class="admonition tip">
<p class="first admonition-title">Tip</p>
<p>Any <code class="docutils literal"><span class="pre">Filter</span></code> implementation may be specified!</p>
<p class="last">However, if you need to implement a new filter, you might find it easier to subclass the <code class="docutils literal"><span class="pre">com.stormpath.sdk.servlet.filter.HttpFilter</span></code> class: it provides some nice conveniences, like enabling/disabling and the ability to access Stormpath configuration properties if necessary.</p>
</div>
<p>You control which filters are executed, and the order they are executed, by declaring URI patterns, covered below.</p>
<div class="section" id="default-filters">
<span id="id4"></span><h3><a class="toc-backref" href="#id20">Default Filters</a><a class="headerlink" href="#default-filters" title="Permalink to this headline">¶</a></h3>
<p>The plugin contains some useful filter implementations pre-configured and ready to use in your URI pattern chains:</p>
<table border="1" class="docutils">
<colgroup>
<col width="7%" />
<col width="46%" />
<col width="47%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Filter Name</th>
<th class="head">Filter Class</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal"><span class="pre">anon</span></code></td>
<td><code class="docutils literal"><span class="pre">com.stormpath.sdk.servlet.filter.AnonymousFilter</span></code></td>
<td>‘anon’ymous users are allowed (anyone). Mostly useful for exclusion rules</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">authc</span></code></td>
<td><code class="docutils literal"><span class="pre">com.stormpath.sdk.servlet.filter.AuthenticationFilter</span></code></td>
<td>Requesting user must be authenticated. If not, redirect to login
or issue http authentication challenge depending on <code class="docutils literal"><span class="pre">Accept</span></code>
header preference rules.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">account</span></code></td>
<td><code class="docutils literal"><span class="pre">com.stormpath.sdk.servlet.filter.account.AccountAuthorizationFilter</span></code></td>
<td>Requesting user must be a known user account and, optionally, must pass
one or more account-specific authorization expressions.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="uris">
<span id="id5"></span><h2><a class="toc-backref" href="#id21">URIs</a><a class="headerlink" href="#uris" title="Permalink to this headline">¶</a></h2>
<p>You can control which filters are executed for any application URI path by defining your own paths in <code class="docutils literal"><span class="pre">stormpath.properties</span></code> locations via the following convention:</p>
<div class="highlight-properties"><div class="highlight"><pre><span></span><span class="na">stormpath.web.uris.URI_PATTERN</span> <span class="o">=</span> <span class="s">FILTER_CHAIN_DEFINITION</span>
</pre></div>
</div>
<p>where:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">ROUTE_PATTERN</span></code> is an <a class="reference external" href="https://ant.apache.org/manual/dirtasks.html#patterns">Ant-style path expression</a> that represents a URI path or path hierarchy (via wildcard <code class="docutils literal"><span class="pre">*</span></code> matching) relative to the web application’s <a class="reference external" href="http://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletRequest.html#getContextPath()">context path</a>.</li>
<li><code class="docutils literal"><span class="pre">FILTER_CHAIN_DEFINITION</span></code> is a comma-delimited list of filter names that match the the names of the a <a class="reference internal" href="#default-filters"><span class="std std-ref">default filter</span></a> or any manually defined filter as described <a class="reference internal" href="#filters"><span class="std std-ref">above</span></a></li>
</ul>
<p>For example:</p>
<p><code class="docutils literal"><span class="pre">stormpath.web.uris./admin/**</span> <span class="pre">=</span> <span class="pre">foo,</span> <span class="pre">bar,</span> <span class="pre">baz</span></code></p>
<p>This configuration line indicates that any request to the <cite>/admin</cite> path or any of its children paths (via the ant-style wildcard of <cite>/admin/**</cite>), the <code class="docutils literal"><span class="pre">foo</span></code> filter should execute, then the <code class="docutils literal"><span class="pre">bar</span></code> filter should execute, then the <code class="docutils literal"><span class="pre">baz</span></code> filter should execute. If the filters all allow the request to continue, then a servlet handler or controller will receive and process the request.</p>
<p>Therefore, the comma-delimited list of filter names defines a <em>filter chain</em> that should execute for that specific URI path. You can define as many URI filter chains as you wish based on your applications needs.</p>
<div class="admonition tip">
<p class="first admonition-title">Tip</p>
<p class="last">Because URI patterns are relative to your web application’s <a class="reference external" href="http://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletRequest.html#getContextPath()">context path</a>, you can deploy your application to <code class="docutils literal"><span class="pre">http://localhost:8080/myapp</span></code> and then later deploy it to <code class="docutils literal"><span class="pre">https://myapp.com</span></code> without changing your URI configuration.</p>
</div>
<div class="section" id="uri-evaluation-priority">
<span id="id6"></span><h3><a class="toc-backref" href="#id22">URI Evaluation Priority</a><a class="headerlink" href="#uri-evaluation-priority" title="Permalink to this headline">¶</a></h3>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p>Order Matters!</p>
<p>URI patterns are evaluated against an incoming request in the order they are defined, and the <em>FIRST MATCH WINS</em>.</p>
<p>For example, let’s assume there are the following path chain definitions:</p>
<div class="highlight-properties"><div class="highlight"><pre><span></span><span class="na">/account/**</span> <span class="o">=</span> <span class="s">authc</span>
<span class="na">/account/signup</span> <span class="o">=</span> <span class="s">anon</span>
</pre></div>
</div>
<p>If an incoming request is intended to reach <code class="docutils literal"><span class="pre">/account/signup</span></code> (accessible by all ‘anon’ymous users), <em>it will never be handled!</em>. The reason is that the <code class="docutils literal"><span class="pre">/account/**</span></code> pattern matched the incoming request first and ‘short-circuited’ all remaining definitions.</p>
<p class="last">Always remember to define your filter chains based on a <em>FIRST MATCH WINS</em> policy.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="registration.html" class="btn btn-neutral float-right" title="Registration" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="quickstart.html" class="btn btn-neutral" title="Quickstart" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2017, Stormpath, Inc.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.5.4',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>