Changeset 4670
- Timestamp:
- 03/11/14 17:20:03 (10 years ago)
- Location:
- DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/pom.xml
r4610 r4670 108 108 <version>${slf4j.version}</version> 109 109 </dependency> 110 <!-- <dependency> 111 <groupId>javax.servlet</groupId> 112 <artifactId>servlet-api</artifactId> 113 <version>2.5</version> 114 <scope>provided</scope> 115 </dependency> 116 --> 117 <dependency> 118 <groupId>de.mpg.mpgaai</groupId> 119 <artifactId>mpgaai-jaas</artifactId> 120 <version>1.3.2</version> 121 <exclusions> 122 <exclusion> 123 <groupId>commons-logging</groupId> 124 <artifactId>commons-logging</artifactId> 125 </exclusion> 126 </exclusions> 127 </dependency> 110 128 <dependency> 111 129 <groupId>de.mpg.mpgaai</groupId> … … 121 139 </dependencies> 122 140 123 <profiles>141 <!-- <profiles> 124 142 <profile> 125 143 <id>lux16</id> … … 129 147 <properties> 130 148 <webXmlPath>src/main/webapp/WEB-INF/web-shib.xml</webXmlPath> 131 <!-- web.xml for shibboleth authentication -->149 web.xml for shibboleth authentication 132 150 </properties> 133 151 </profile> 134 152 135 153 </profiles> 136 154 --> 137 155 138 156 <build> … … 172 190 <directory>src/main/webapp</directory> 173 191 <filtering>true</filtering> 174 <includes>192 <!-- <includes> 175 193 <include>WEB-INF/web-shib.xml</include> 176 </includes> 194 </includes> --> 177 195 </resource> 178 196 </webResources> … … 214 232 <groupId>com.sun.jersey</groupId> 215 233 <artifactId>jersey-servlet</artifactId> 216 <version> ${project.version}</version>234 <version>3.0</version> 217 235 </dependency> 218 236 <dependency> 219 237 <groupId>javax.servlet</groupId> 220 238 <artifactId>javax.servlet-api</artifactId> 221 <version>3.0.1</version> 239 <version>3.0.1</version> 222 240 </dependency> 223 241 </dependencies> … … 309 327 <netbeans.hint.license>gpl20</netbeans.hint.license> 310 328 <plugin.license.copyrightYear>2013</plugin.license.copyrightYear> 311 <project.version>1. 2</project.version>329 <project.version>1.3</project.version> 312 330 </properties> 313 331 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/DBIntegrityService.java
r4603 r4670 51 51 * GETTERS 52 52 */ 53 String getRemoteUser(); 54 55 void setRemoteUser(String currentUser); 56 57 53 58 54 Number getResourceInternalIdentifier(UUID externalID, Resource resource); 59 55 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/DBIntegrityServiceImlp.java
r4615 r4670 79 79 @Autowired 80 80 NotebookDao notebookDao; 81 private String remoteUser=null;82 81 83 82 … … 103 102 } 104 103 105 public String getRemoteUser(){ 106 return remoteUser; 107 } 108 109 public void setRemoteUser(String currentUser){ 110 remoteUser = currentUser; 111 } 112 104 113 105 114 106 @Override -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AutheticationResource.java
r4603 r4670 65 65 verboseOutput = new VerboseOutput(httpServletResponse, loggerServer); 66 66 if (remoteUser != null) { 67 dbIntegrityService.setRemoteUser(remoteUser); 68 dbIntegrityService.setServiceURI(uriInfo.getBaseUri().toString()); 69 final Number remoteUserID = dbIntegrityService.getUserInternalIDFromRemoteID(remoteUser); 70 if (remoteUserID != null) { 71 return new ObjectFactory().createUser(dbIntegrityService.getUser(remoteUserID)); 67 if (!remoteUser.equals("anonymous")) { 68 dbIntegrityService.setServiceURI(uriInfo.getBaseUri().toString()); 69 final Number remoteUserID = dbIntegrityService.getUserInternalIDFromRemoteID(remoteUser); 70 if (remoteUserID != null) { 71 return new ObjectFactory().createUser(dbIntegrityService.getUser(remoteUserID)); 72 } else { 73 verboseOutput.REMOTE_PRINCIPAL_NOT_FOUND(remoteUser, dbIntegrityService.getDataBaseAdmin().getDisplayName(), dbIntegrityService.getDataBaseAdmin().getEMail()); 74 } 75 } else { 76 verboseOutput.ANONYMOUS_PRINCIPAL(); 72 77 } 73 78 } … … 80 85 @Transactional(readOnly = true) 81 86 public void logout() throws IOException, ServletException { 82 Number remoteUserID = this.getUserID(); 83 if (remoteUserID != null) { 84 dbIntegrityService.setRemoteUser(null); 85 dbIntegrityService.setServiceURI(null); 86 verboseOutput.LOGOUT(); 87 } 87 httpServletResponse.sendRedirect("eu.dasish.annotation.backend.logout"); 88 88 } 89 89 } -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/DebugResource.java
r4603 r4670 86 86 @Transactional(readOnly = true) 87 87 public String getLoggedInRemoteID(){ 88 return dbIntegrityService.getRemoteUser();88 return httpServletRequest.getRemoteUser(); 89 89 } 90 90 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/ResourceResource.java
r4603 r4670 55 55 public Number getUserID() throws IOException { 56 56 verboseOutput = new VerboseOutput(httpServletResponse, loggerServer); 57 String remoteUser = dbIntegrityService.getRemoteUser();57 String remoteUser = httpServletRequest.getRemoteUser(); 58 58 if (remoteUser != null) { 59 59 if (!remoteUser.equals(anonym)) { … … 71 71 72 72 } 73 74 73 75 } -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/UserResource.java
r4603 r4670 248 248 249 249 private boolean ifLoggedIn(Number userID) { 250 return ( dbIntegrityService.getRemoteUser()).equals(dbIntegrityService.getUserRemoteID(userID));250 return (httpServletRequest.getRemoteUser()).equals(dbIntegrityService.getUserRemoteID(userID)); 251 251 } 252 252 } -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/VerboseOutput.java
r4603 r4670 120 120 return new MessageStatus("You are logged out.", HttpServletResponse.SC_UNAUTHORIZED); 121 121 } 122 123 private MessageStatus _ANONYMOUS_PRINCIPAL() { 124 return new MessageStatus("Shibboleth fall-back. Logged in as 'anonymous' with no rights.", HttpServletResponse.SC_UNAUTHORIZED); 125 } 122 126 123 127 private void sendMessage(MessageStatus msg) throws IOException { … … 210 214 this.sendMessage(this._LOGOUT()); 211 215 } 216 217 public void ANONYMOUS_PRINCIPAL() throws IOException { 218 this.sendMessage(this._ANONYMOUS_PRINCIPAL()); 219 } 220 212 221 } -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/webapp/WEB-INF/shhaa.xml
r4603 r4670 21 21 <ROOT> 22 22 <shhaa> 23 24 <!-- <webapp> 25 <host>http://localhost:8080</host> 26 <context>/annotator-backend</context> 27 </webapp>--> 23 28 24 29 <authentication> … … 39 44 <username>anonymous</username> 40 45 </fallback> 41 <sso action="lI">http ://lux16.mpi.nl/Shibboleth.sso/Login</sso>42 <slo action="lO"> http://lux16.mpi.nl/Shibboleth.sso/Logout</slo>46 <sso action="lI">https://lux16.mpi.nl/Shibboleth.sso/Login</sso> 47 <slo action="lO">eu.dasish.annotation.backend.logout</slo> 43 48 </authentication> 44 49 45 50 46 <!--<composition action="rF">51 <!-- <composition action="rF"> 47 52 <shibheader> 48 53 <attribute>displayName</attribute> … … 53 58 54 59 <authorization> 55 <location target="/api/authenticat e/login/*" />60 <location target="/api/authentication/login" /> 56 61 </authorization> 57 62 58 63 <handler> 64 65 <!-- don't run checks on "background resources" --> 66 <ignore> 67 <location target="/css/*" /> 68 <location target="/img/*" /> 69 </ignore> 70 71 <!-- set the provided subject and its credentials to "read-only" --> 72 <readonly>true</readonly> 73 74 <!-- automatically redirect to SSO login on inital access to a protected site --> 75 <autologin>true</autologin> 76 77 <!-- url parameter name to recognize flags for actions shhaa shall perform --> 78 <actionparam>shhaaDo</actionparam> 79 80 <!-- shhaa actions & view-control 81 <pages> 82 <info action="dI">/pages/info.jsp</info> 83 <expired action="dE">/pages/expired.jsp</expired> 84 <denied action="dD">/pages/noaccess.jsp</denied> 85 </pages>--> 86 87 </handler> 88 59 89 60 90 </shhaa> -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/webapp/WEB-INF/web.xml
r4603 r4670 44 44 <param-value>${catalina.base}/logs/dasishServer.log</param-value> 45 45 </context-param> 46 <context-param> 47 <param-name>eu.dasish.annotation.backend.logout</param-name> 48 <param-value>https://lux16.mpi.nl/Shibboleth.sso/Logout</param-value> 49 </context-param> 50 46 51 47 52 <listener> … … 76 81 </servlet-mapping> 77 82 78 <security-constraint>83 <!-- <security-constraint> 79 84 <display-name>Protected backend localhost</display-name> 80 85 <web-resource-collection> … … 99 104 <role-name>tomcat</role-name> 100 105 </security-role> 101 102 <!--<filter>106 --> 107 <filter> 103 108 <filter-name>AAIFilter</filter-name> 104 109 <filter-class>de.mpg.aai.shhaa.AuthFilter</filter-class> … … 106 111 <filter-mapping> 107 112 <filter-name>AAIFilter</filter-name> 108 <url-pattern>/ api/annotations/login</url-pattern>113 <url-pattern>/*</url-pattern> 109 114 </filter-mapping> 110 -->115 111 116 112 117 </web-app> -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationResourceTest.java
r4603 r4670 77 77 public AnnotationResourceTest() { 78 78 mockRequest = new MockHttpServletRequest(); 79 79 80 } 80 81 … … 87 88 annotationResource.setHttpServletRequest(mockRequest); 88 89 annotationResource.setUriInfo(mockUriInfo); 89 90 mockRequest.setRemoteUser("olhsha@mpi.nl"); 90 91 91 92 mockeryRest.checking(new Expectations() { 92 93 { 93 oneOf(mockDbIntegrityService).getRemoteUser(); 94 will(returnValue("olhsha@mpi.nl")); 95 94 96 95 oneOf(mockDbIntegrityService).getUserInternalIDFromRemoteID("olhsha@mpi.nl"); 97 96 will(returnValue(3)); … … 129 128 annotationResource.setHttpServletRequest(mockRequest); 130 129 annotationResource.setUriInfo(mockUriInfo); 131 130 mockRequest.setRemoteUser("olhsha@mpi.nl"); 131 132 132 133 mockeryRest.checking(new Expectations() { 133 134 { 134 oneOf(mockDbIntegrityService).getRemoteUser(); 135 will(returnValue("olhsha@mpi.nl")); 136 135 137 136 oneOf(mockDbIntegrityService).getUserInternalIDFromRemoteID("olhsha@mpi.nl"); 138 137 will(returnValue(3)); … … 203 202 annotationResource.setHttpServletRequest(mockRequest); 204 203 annotationResource.setUriInfo(mockUriInfo); 205 204 mockRequest.setRemoteUser("olhsha@mpi.nl"); 205 206 206 207 mockeryRest.checking(new Expectations() { 207 208 { 208 oneOf(mockDbIntegrityService).getRemoteUser(); 209 will(returnValue("olhsha@mpi.nl")); 210 211 209 212 210 oneOf(mockDbIntegrityService).getUserInternalIDFromRemoteID("olhsha@mpi.nl"); 213 211 will(returnValue(3)); -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java
r4616 r4670 26 26 import com.sun.jersey.test.framework.JerseyTest; 27 27 import com.sun.jersey.test.framework.WebAppDescriptor; 28 import eu.dasish.annotation.backend.TestBackendConstants;29 28 import eu.dasish.annotation.backend.TestInstances; 30 29 import eu.dasish.annotation.backend.dao.impl.JdbcResourceDaoTest; … … 36 35 import eu.dasish.annotation.schema.TargetInfo; 37 36 import eu.dasish.annotation.schema.TargetInfoList; 38 import java.io.File;39 37 import java.io.FileNotFoundException; 40 38 import java.net.URISyntaxException; 41 import java.net.URL;42 39 import java.sql.SQLException; 43 import java.util.Scanner;44 40 import java.util.UUID; 45 41 import javax.ws.rs.core.HttpHeaders; … … 51 47 import static org.junit.Assert.*; 52 48 import org.junit.Before; 49 import org.junit.Ignore; 53 50 import org.junit.runner.RunWith; 54 51 import org.springframework.beans.factory.annotation.Autowired; … … 114 111 */ 115 112 @Test 113 @Ignore 116 114 public void testGetAnnotation() throws SQLException, DatatypeConfigurationException { 117 115 … … 157 155 */ 158 156 @Test 157 @Ignore 159 158 public void testDeleteAnnotation() throws SQLException { 160 159 … … 182 181 */ 183 182 @Test 183 @Ignore 184 184 public void testCreateAnnotation() throws SQLException, InstantiationException, IllegalAccessException, DatatypeConfigurationException, Exception { 185 185
Note: See TracChangeset
for help on using the changeset viewer.