Announcement Announcement Module
Collapse
No announcement yet.
How to implement 2-legged OAuth to authenticate client requests? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Sample working code

    Hi,

    Did one today. Sorry for the delay. Was tied up. twolegged.zip contains the server project and you should be able to build and deploy that. The other zip is the client code and it's pom is also attached. Let me know if this works for you.
    Last edited by subhashish; Nov 30th, 2011, 11:55 PM.

    Comment


    • #17
      Hi,
      Thanks for sharing the code!
      I'm having trouble opening the client code zip file. I keep getting a "not a valid zip" error message.
      Any chance you could upload it again?
      Thanks again

      Comment


      • #18
        Can you try with 7-zip please. It extracts fine with that.

        Comment


        • #19
          Originally posted by subhashish View Post
          Can you try with 7-zip please. It extracts fine with that.
          Thanks, that worked!

          Comment


          • #20
            Sorry to resurrect an older thread, but I can't seem to get your examples working subhashish. When I try and run the twolegged project on tomcat it throws

            SEVERE: Exception starting filter springSecurityFilterChain
            java.lang.ClassNotFoundException: org.springframework.web.filter.DelegatingFilterPro xy
            ...

            I've rebuilt/cleaned and checked the maven dependencies over and over and can't seem to get it to work.

            Any thoughts?

            Comment


            • #21
              Originally posted by Ian Donaldson View Post
              java.lang.ClassNotFoundException: org.springframework.web.filter.DelegatingFilterPro xy
              Any chance you have a space in org.springframework.web.filter.DelegatingFilterPro xy? If that's not an issue, can you check if spring security jar is in the classpath (which it should be).

              I am able to build and run on my machine.

              Comment


              • #22
                No space in the filter name or class.

                And my dependencies look like

                Code:
                <properties>
                  	<spring.version>3.1.0.RELEASE</spring.version>
                  </properties>
                  <build>
                  	<finalName>twolegged</finalName>
                  	<plugins>
                		<plugin>
                			<groupId>org.apache.maven.plugins</groupId>
                			<artifactId>maven-compiler-plugin</artifactId>
                			<version>2.3.2</version>
                			<inherited>true</inherited>
                			<configuration>
                				<source>1.6</source>
                				<target>1.6</target>
                			</configuration>
                		</plugin>
                  	</plugins>
                  </build>
                  
                  <dependencies>
                     <dependency>
                         <groupId>javax.servlet</groupId>
                         <artifactId>servlet-api</artifactId>
                         <version>2.5</version>
                         <scope>provided</scope>
                     </dependency>
                		<dependency>
                		    <groupId>com.h2database</groupId>
                		    <artifactId>h2</artifactId>
                		    <version>1.3.159</version>
                		</dependency>
                		<dependency>
                		    <groupId>ch.qos.logback</groupId>
                		    <artifactId>logback-core</artifactId>
                		    <version>0.9.29</version>
                		</dependency>		
                		
                		<dependency>
                		    <groupId>ch.qos.logback</groupId>
                		    <artifactId>logback-classic</artifactId>
                		    <version>0.9.29</version>
                		</dependency>
                		
                		<dependency>
                		  <groupId>org.slf4j</groupId>
                		  <artifactId>slf4j-api</artifactId>
                		  <version>1.6.1</version>
                		</dependency>		
                
                		<dependency>
                		  <groupId>org.slf4j</groupId>
                		  <artifactId>jcl-over-slf4j</artifactId>
                		  <version>1.6.1</version>
                		</dependency>
                		<dependency>
                			<groupId>org.springframework.security</groupId>
                			<artifactId>spring-security-web</artifactId>
                			<version>${spring.version}</version>
                		</dependency>
                		
                		<dependency>
                			<groupId>org.springframework.security</groupId>
                			<artifactId>spring-security-config</artifactId>
                			<version>${spring.version}</version>
                		</dependency>
                		<dependency>
                		  <groupId>org.springframework</groupId>
                		  <artifactId>spring-core</artifactId>
                		  <version>${spring.version}</version>
                		</dependency>
                		<dependency> 
                		  <groupId>org.springframework</groupId>
                		  <artifactId>spring-beans</artifactId>
                		  <version>${spring.version}</version>
                		</dependency>
                		<dependency>
                		  <groupId>org.springframework</groupId>
                		  <artifactId>spring-context</artifactId>
                		  <version>${spring.version}</version>
                	      <exclusions>
                	         <exclusion>
                	            <groupId>commons-logging</groupId>
                	            <artifactId>commons-logging</artifactId>
                	         </exclusion>
                	      </exclusions>		
                		</dependency>
                		<dependency>
                		  <groupId>org.springframework</groupId>
                		  <artifactId>spring-web</artifactId>
                		  <version>${spring.version}</version>
                		</dependency>
                		<dependency>
                		  <groupId>org.springframework</groupId>
                		  <artifactId>spring-webmvc</artifactId>
                		  <version>${spring.version}</version>
                		</dependency>		
                		<dependency>
                			<groupId>org.springframework.security.oauth</groupId>
                			<artifactId>spring-security-oauth</artifactId>
                			<version>1.0.0.M4</version>
                		</dependency>														 	  		     
                  </dependencies>
                The only difference being my spring versions went to the 3.1 release.

                Comment


                • #23
                  The only difference being my spring versions went to the 3.1 release.
                  I changed to 3.1.0.RELEASE too and it worked with that. This is a wierd problem now. Are you deploying from within your IDE or outside on a container? Can you try it on a standalone tomcat instance. Also make sure spring-security jar is in the war and shows the concerned class.

                  Comment


                  • #24
                    I am deploying within eclipse, I don't have a standalone tomcat instance readily available at the moment.

                    And the spring-security jars that maven pulls down are:

                    spring-security-web-3.1.0.RELEASE
                    spring-security-core-3.1.0.RELEASE
                    spring-security-crypto-3.1.0.RELEASE
                    spring-security-config-3.1.0.RELEASE
                    spring-security-oauth-1.0.0.M4

                    You are building with Maven I assume?
                    Last edited by Ian Donaldson; May 15th, 2012, 12:20 PM.

                    Comment


                    • #25
                      You are building with Maven I assume?
                      Good question and I have a hunch that in the answer to it lies the answer to your woes . Yes, I build with maven. However here's something that I have observed. Looks like if you deploy in the container within the IDE, the maven built war (typically in target folder) doesn't get deployed. The IDE plugin creates in own war again and deploys that. That can cause some strife sometimes. When I use the IDE (STS in my case), I make sure I do a "Clean->Build Automatically" for the project before deploying.
                      I'd again suggest you install Tomcat (5 mins at the max), deploy your maven built war on it and (less than a minute) and see what happens.

                      Comment

                      Working...
                      X