Changeset 4670


Ignore:
Timestamp:
03/11/14 17:20:03 (10 years ago)
Author:
olhsha
Message:

removing remote user from dbIntegrityservice (not saved any more)

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  
    108108            <version>${slf4j.version}</version>
    109109        </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>
    110128        <dependency>
    111129            <groupId>de.mpg.mpgaai</groupId>
     
    121139    </dependencies>
    122140   
    123     <profiles>
     141<!--    <profiles>
    124142        <profile>
    125143            <id>lux16</id>
     
    129147            <properties>
    130148                <webXmlPath>src/main/webapp/WEB-INF/web-shib.xml</webXmlPath>
    131                 <!-- web.xml for shibboleth authentication -->
     149                 web.xml for shibboleth authentication
    132150            </properties>
    133151        </profile>
    134152   
    135153    </profiles>
    136        
     154       -->
    137155       
    138156    <build>
     
    172190                            <directory>src/main/webapp</directory>
    173191                            <filtering>true</filtering>
    174                             <includes> 
     192<!--                            <includes> 
    175193                                <include>WEB-INF/web-shib.xml</include>
    176                             </includes>
     194                            </includes> -->
    177195                        </resource>
    178196                    </webResources>
     
    214232                        <groupId>com.sun.jersey</groupId>
    215233                        <artifactId>jersey-servlet</artifactId>
    216                         <version>${project.version}</version>
     234                        <version>3.0</version>
    217235                    </dependency>
    218236                    <dependency>
    219237                        <groupId>javax.servlet</groupId>
    220238                        <artifactId>javax.servlet-api</artifactId>
    221                         <version>3.0.1</version>
     239                        <version>3.0.1</version>                     
    222240                    </dependency>
    223241                </dependencies>
     
    309327        <netbeans.hint.license>gpl20</netbeans.hint.license> 
    310328        <plugin.license.copyrightYear>2013</plugin.license.copyrightYear>
    311         <project.version>1.2</project.version>
     329        <project.version>1.3</project.version>
    312330    </properties>
    313331   
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/DBIntegrityService.java

    r4603 r4670  
    5151     * GETTERS
    5252     */
    53     String getRemoteUser();
    54    
    55     void setRemoteUser(String currentUser);
    56    
    57    
     53     
    5854    Number getResourceInternalIdentifier(UUID externalID, Resource resource);
    5955
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/DBIntegrityServiceImlp.java

    r4615 r4670  
    7979    @Autowired
    8080    NotebookDao notebookDao;
    81     private String remoteUser=null;
    8281   
    8382   
     
    103102    }
    104103   
    105     public String getRemoteUser(){
    106         return remoteUser;
    107     }
    108    
    109     public void setRemoteUser(String currentUser){
    110         remoteUser = currentUser;
    111     }
    112    
     104   
    113105
    114106    @Override
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AutheticationResource.java

    r4603 r4670  
    6565        verboseOutput = new VerboseOutput(httpServletResponse, loggerServer);
    6666        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();
    7277            }
    7378        }
     
    8085    @Transactional(readOnly = true)
    8186    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");
    8888    }
    8989}
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/DebugResource.java

    r4603 r4670  
    8686    @Transactional(readOnly = true)
    8787    public String getLoggedInRemoteID(){
    88         return dbIntegrityService.getRemoteUser();
     88        return httpServletRequest.getRemoteUser();
    8989    }
    9090
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/ResourceResource.java

    r4603 r4670  
    5555    public Number getUserID() throws IOException {
    5656        verboseOutput = new VerboseOutput(httpServletResponse, loggerServer);
    57         String remoteUser = dbIntegrityService.getRemoteUser();       
     57        String remoteUser = httpServletRequest.getRemoteUser();       
    5858        if (remoteUser != null) {
    5959            if (!remoteUser.equals(anonym)) {
     
    7171
    7272    }
     73   
     74   
    7375}
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/UserResource.java

    r4603 r4670  
    248248
    249249    private boolean ifLoggedIn(Number userID) {
    250         return (dbIntegrityService.getRemoteUser()).equals(dbIntegrityService.getUserRemoteID(userID));
     250        return (httpServletRequest.getRemoteUser()).equals(dbIntegrityService.getUserRemoteID(userID));
    251251    }
    252252}
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/VerboseOutput.java

    r4603 r4670  
    120120        return new MessageStatus("You are logged out.", HttpServletResponse.SC_UNAUTHORIZED);
    121121    }
     122   
     123    private MessageStatus _ANONYMOUS_PRINCIPAL() {
     124        return new MessageStatus("Shibboleth fall-back.  Logged in as 'anonymous' with no rights.", HttpServletResponse.SC_UNAUTHORIZED);
     125    }
    122126
    123127    private void sendMessage(MessageStatus msg) throws IOException {
     
    210214        this.sendMessage(this._LOGOUT());
    211215    }
     216   
     217    public void ANONYMOUS_PRINCIPAL() throws IOException {
     218        this.sendMessage(this._ANONYMOUS_PRINCIPAL());
     219    }
     220   
    212221}
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/webapp/WEB-INF/shhaa.xml

    r4603 r4670  
    2121<ROOT>
    2222    <shhaa>
     23       
     24<!--        <webapp>
     25                <host>http://localhost:8080</host>
     26                <context>/annotator-backend</context>
     27        </webapp>-->
    2328
    2429        <authentication>
     
    3944                <username>anonymous</username>
    4045            </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>
    4348        </authentication>
    4449       
    4550       
    46         <!-- <composition action="rF">
     51<!--        <composition action="rF">
    4752            <shibheader>
    4853                        <attribute>displayName</attribute>
     
    5358       
    5459        <authorization>
    55             <location  target="/api/authenticate/login/*" />
     60            <location  target="/api/authentication/login" />
    5661        </authorization>
    5762       
    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       
    5989       
    6090    </shhaa>
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/webapp/WEB-INF/web.xml

    r4603 r4670  
    4444        <param-value>${catalina.base}/logs/dasishServer.log</param-value>
    4545    </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   
    4651   
    4752    <listener>
     
    7681    </servlet-mapping>
    7782   
    78     <security-constraint>
     83<!--    <security-constraint>
    7984        <display-name>Protected backend localhost</display-name>
    8085        <web-resource-collection>
     
    99104        <role-name>tomcat</role-name>
    100105    </security-role>
    101    
    102 <!--    <filter>
     106    -->
     107    <filter>
    103108        <filter-name>AAIFilter</filter-name>
    104109        <filter-class>de.mpg.aai.shhaa.AuthFilter</filter-class>
     
    106111    <filter-mapping>
    107112        <filter-name>AAIFilter</filter-name>
    108         <url-pattern>/api/annotations/login</url-pattern>
     113        <url-pattern>/*</url-pattern>
    109114    </filter-mapping>
    110     -->
     115   
    111116   
    112117</web-app>
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationResourceTest.java

    r4603 r4670  
    7777    public AnnotationResourceTest() {
    7878        mockRequest = new MockHttpServletRequest();
     79       
    7980    }
    8081   
     
    8788        annotationResource.setHttpServletRequest(mockRequest);
    8889        annotationResource.setUriInfo(mockUriInfo);
    89 
     90        mockRequest.setRemoteUser("olhsha@mpi.nl");
    9091
    9192        mockeryRest.checking(new Expectations() {
    9293            { 
    93                 oneOf(mockDbIntegrityService).getRemoteUser();
    94                 will(returnValue("olhsha@mpi.nl"));
    95                        
     94                     
    9695                oneOf(mockDbIntegrityService).getUserInternalIDFromRemoteID("olhsha@mpi.nl");
    9796                will(returnValue(3));
     
    129128        annotationResource.setHttpServletRequest(mockRequest);
    130129        annotationResource.setUriInfo(mockUriInfo);
    131 
     130        mockRequest.setRemoteUser("olhsha@mpi.nl");
     131       
     132       
    132133        mockeryRest.checking(new Expectations() {
    133134            {
    134                 oneOf(mockDbIntegrityService).getRemoteUser();
    135                 will(returnValue("olhsha@mpi.nl"));
    136                
     135               
    137136                oneOf(mockDbIntegrityService).getUserInternalIDFromRemoteID("olhsha@mpi.nl");
    138137                will(returnValue(3));
     
    203202        annotationResource.setHttpServletRequest(mockRequest);
    204203        annotationResource.setUriInfo(mockUriInfo);
    205 
     204        mockRequest.setRemoteUser("olhsha@mpi.nl");
     205       
     206       
    206207        mockeryRest.checking(new Expectations() {
    207208            {
    208                 oneOf(mockDbIntegrityService).getRemoteUser();
    209                 will(returnValue("olhsha@mpi.nl"));
    210                
    211              
     209               
    212210                oneOf(mockDbIntegrityService).getUserInternalIDFromRemoteID("olhsha@mpi.nl");
    213211                will(returnValue(3));
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/rest/AnnotationsTest.java

    r4616 r4670  
    2626import com.sun.jersey.test.framework.JerseyTest;
    2727import com.sun.jersey.test.framework.WebAppDescriptor;
    28 import eu.dasish.annotation.backend.TestBackendConstants;
    2928import eu.dasish.annotation.backend.TestInstances;
    3029import eu.dasish.annotation.backend.dao.impl.JdbcResourceDaoTest;
     
    3635import eu.dasish.annotation.schema.TargetInfo;
    3736import eu.dasish.annotation.schema.TargetInfoList;
    38 import java.io.File;
    3937import java.io.FileNotFoundException;
    4038import java.net.URISyntaxException;
    41 import java.net.URL;
    4239import java.sql.SQLException;
    43 import java.util.Scanner;
    4440import java.util.UUID;
    4541import javax.ws.rs.core.HttpHeaders;
     
    5147import static org.junit.Assert.*;
    5248import org.junit.Before;
     49import org.junit.Ignore;
    5350import org.junit.runner.RunWith;
    5451import org.springframework.beans.factory.annotation.Autowired;
     
    114111     */
    115112    @Test
     113    @Ignore
    116114    public void testGetAnnotation() throws SQLException, DatatypeConfigurationException {
    117115       
     
    157155     */
    158156    @Test
     157    @Ignore
    159158    public void testDeleteAnnotation() throws SQLException {
    160159       
     
    182181     */
    183182    @Test
     183    @Ignore
    184184    public void testCreateAnnotation() throws SQLException, InstantiationException, IllegalAccessException, DatatypeConfigurationException, Exception {
    185185       
Note: See TracChangeset for help on using the changeset viewer.