Note that there are some explanatory texts on larger screens.

plurals
  1. POImplementing auth in web application
    text
    copied!<p>I want to use auth application for my web application to skip the registration process for user . I am using <a href="http://code.google.com/p/socialauth/" rel="nofollow">http://code.google.com/p/socialauth/</a> java library for implementation of auth.I am facing following problem</p> <p>1.I have created the secret key with those auth provider like twitter. but i am having problem while running this app locally on my system as i give the address of my site required while generating the secret key.</p> <p>2.I am not able to configure my host file so that it take the properties my the address which i gave while generating the secret key .</p> <p>Here is the piece of code executing .</p> <pre><code>package com.auth.actions; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.util.RequestUtils; import org.brickred.socialauth.AuthProvider; import org.brickred.socialauth.AuthProviderFactory; import com.auth.form.AuthForm; public class SocialAuthenticationAction extends Action { final Log LOG = LogFactory.getLog(SocialAuthenticationAction.class); @Override public ActionForward execute(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, final HttpServletResponse response) throws Exception { AuthForm authForm = (AuthForm) form; String id = authForm.getId(); System.out.println("in authentieavtaonsdfsaf"); AuthProvider provider = AuthProviderFactory.getInstance(id); String returnToUrl = RequestUtils.absoluteURL(request,"/socialAuthSuccessAction.do").toString(); authForm.setProvider(provider); String url = provider.getLoginRedirectURL(returnToUrl); LOG.info("Redirecting to: " + url); if (url != null) { ActionForward fwd = new ActionForward("openAuthUrl", url, true); return fwd; } return mapping.findForward("failure"); } } </code></pre> <p>Here at line number 23 it is thowing null pointer exception saying that provider is coming as null</p> <p>ERROR MSG::</p> <blockquote> <p>Jan 23, 2011 12:26:23 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet action threw exception java.lang.NullPointerException at java.util.Properties$LineReader.readLine(Unknown Source) at java.util.Properties.load0(Unknown Source) at java.util.Properties.load(Unknown Source) at org.brickred.socialauth.AuthProviderFactory.getInstance(AuthProviderFactory.java:72) at com.auth.actions.SocialAuthenticationAction.execute(SocialAuthenticationAction.java:31) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source)</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload