Repository navigation
Expand file tree
/
Copy pathConfiguring-Basic-Security.rtf
More file actions
86 lines (84 loc) · 3.34 KB
/
Copy pathConfiguring-Basic-Security.rtf
File metadata and controls
86 lines (84 loc) · 3.34 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
{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf140
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fswiss\fcharset0 ArialMT;}
{\colortbl;\red255\green255\blue255;\red26\green26\blue26;\red255\green255\blue255;\red16\green60\blue192;
}
\margl1440\margr1440\vieww25400\viewh14500\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\f0\fs24 \cf0 Steps To Configure and Test Basic Security:\
\
\pard\pardeftab720
\f1\fs26 \cf2 \cb3 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \strokec2 1)Open the web.xml under WEB-INF directory of your restws eclipse project.\
\pard\pardeftab720
\cf2 \cb1 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \
\pard\pardeftab720
\cf2 \cb3 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 2)Go to the end of web.xml. Copy the below xml. Paste before the </web-app> in the web.xml.\
\pard\pardeftab720
\cf2 \cb1 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \
\
\pard\pardeftab720
\cf2 \cb3 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 <security-constraint>\
<web-resource-collection>\
<web-resource-name>Wildcard * means all the resources in the application require authentication</web-resource-name>\
<url-pattern>/*</url-pattern>\
<http-method>GET</http-method>\
<http-method>POST</http-method>\
<http-method>PUT</http-method>\
<http-method>DELETE</http-method>\
</web-resource-collection>\
<auth-constraint>\
<role-name>tomcat</role-name>\
</auth-constraint>\
</security-constraint>\
\pard\pardeftab720
\cf2 \cb1 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \
\pard\pardeftab720
\cf2 \cb3 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 <login-config>\
<auth-method>BASIC</auth-method>\
</login-config>\
\
3) Open the tomcat-users.xml in eclipse (short cut to search in eclipse ctlr->shift->r)\
\pard\pardeftab720
\cf2 \cb1 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \
\pard\pardeftab720
\cf2 \cb3 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 4) Remove the xml comments around the following section.\
\pard\pardeftab720
\cf2 \cb1 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \
\pard\pardeftab720
\cf2 \cb3 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \'a0 <role rolename="tomcat"/>\
\'a0 <role rolename="role1"/>\
\'a0 <user username="tomcat" password="tomcat" roles="tomcat"/>\
\'a0 <user username="both" password="tomcat" roles="tomcat,role1"/>\
\'a0 <user username="role1" password="tomcat" roles="role1"/>\
\'a0\'a0\
5) Restart the tomcat server in eclipse\
\pard\pardeftab720
\cf2 \cb1 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \
\pard\pardeftab720
\cf2 \cb3 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 6) Access the patient information using the following URL (BROWSER USES HTTP GET METHOD BY DEFAULT FOR URLS)\
\pard\pardeftab720
\cf2 \cb1 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \
\pard\pardeftab720
{\field{\*\fldinst{HYPERLINK "http://localhost:8080/restws/services/patientservice/patients/123"}}{\fldrslt \cf4 \cb3 \expnd0\expndtw0\kerning0
\ul \ulc4 \outl0\strokewidth0 \strokec4 http://localhost:8080/restws/services/patientservice/patients/123}}\cb3 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \
\pard\pardeftab720
\cf2 \cb1 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \
\pard\pardeftab720
\cf2 \cb3 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 Enter \'93tomcat\'94 for user name and \'93tomcat\'94 for password when prompted on the basic authentication popup.\
}