Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changes...

  • Loading branch information...
commit 5b3cc219e1b179a76defcb10c98a82ce48eac393 1 parent 673b3c3
@user454322 authored
View
9 pom.xml
@@ -71,7 +71,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
- <version>2.4.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -124,5 +123,11 @@
</build>
</profile>
</profiles>
-
+
+ <parent>
+ <groupId>org.sonatype.oss</groupId>
+ <artifactId>oss-parent</artifactId>
+ <version>7</version>
+ </parent>
+
</project>
View
17 sample/pom.xml
@@ -19,7 +19,7 @@
<dependency>
<groupId>info.modprobe</groupId>
<artifactId>browserid-verifier</artifactId>
- <version>0.1.0</version>
+ <version>0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -37,6 +37,12 @@
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
<build>
@@ -57,4 +63,13 @@
</plugin>
</plugins>
</build>
+
+ <repositories>
+ <repository>
+ <id>browserid-snapshots</id>
+ <name>browserid-snapshots</name>
+ <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
+ </repository>
+ </repositories>
+
</project>
View
27 sample/src/main/java/info/modprobe/browserid/sample/servlet/In.java
@@ -20,34 +20,33 @@
@WebServlet(value = "/in")
public class In extends HttpServlet {
- private static final long serialVersionUID = -452837824924983487L;
+ private static final long serialVersionUID = -452837824924983488L;
private static final Logger log = LoggerFactory.getLogger(In.class);
@Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
+ protected void doPost(final HttpServletRequest req,
+ final HttpServletResponse resp) throws ServletException,
+ IOException {
- resp.setContentType("text/html");
- PrintWriter out = resp.getWriter();
-
- final Verifier verifier = new Verifier();
final String audience = req.getServerName();
final String assertion = req.getParameter("assertion");
- BrowserIDResponse personaResponse = verifier
- .verify(assertion, audience);
- Status status = personaResponse.getStatus();
+ final Verifier verifier = new Verifier();
+ final BrowserIDResponse personaResponse = verifier.verify(assertion,
+ audience);
+ final Status status = personaResponse.getStatus();
+
if (status == Status.OK) {
+ /* Authentication with Persona was successful */
String email = personaResponse.getEmail();
log.info("{} has sucessfully signed in", email);
HttpSession session = req.getSession(true);
session.setAttribute("email", email);
- out.print("okay");
} else {
- log.info("Failed...");
- out.print("failure");
+ /* Authentication with Persona failed */
+ log.info("Sign in failed...");
+
}
- out.close();
}
}
View
9 sample/src/main/java/info/modprobe/browserid/sample/servlet/Out.java
@@ -11,12 +11,13 @@
@WebServlet(value = "/out")
public class Out extends HttpServlet {
-
- private static final long serialVersionUID = -2559085906064523566L;
+
+ private static final long serialVersionUID = -2559085906064523567L;
@Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
+ protected void doPost(final HttpServletRequest req,
+ final HttpServletResponse resp) throws ServletException,
+ IOException {
final HttpSession session = req.getSession(false);
if (session != null) {
View
30 sample/src/main/webapp/index.htm → sample/src/main/webapp/index.jsp
@@ -1,3 +1,4 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>Sample</title>
@@ -11,26 +12,29 @@
Persona</a> a Browser ID implementation
</h2>
- <br>
+ <br> *${sessionScope.email}*
+ <c:choose>
+ <c:when test="${empty sessionScope.email}">
+ <input type="image" src="persona-only-signin-link.png" name="image"
+ onclick="navigator.id.request();">
-
- <input type="image" src="persona-only-signin-link.png" name="image"
- onclick="navigator.id.request();">
-
-
- <h3>
- <a href="https://github.com/user454322/browserid-verifier"> Simple
- Java BrowserID Verifier </a>
- </h3>
-
+ <h3>
+ <a href="https://github.com/user454322/browserid-verifier">
+ Simple Java BrowserID Verifier </a>
+ </h3>
+ </c:when>
+ <c:otherwise>
+ Logout
+ </c:otherwise>
+ </c:choose>
<script src="https://login.persona.org/include.js"></script>
<script type="text/javascript">
- var currentUser = '#{account}';
+ var currentUser = '';
navigator.id.watch({
loggedInUser : currentUser,
@@ -46,7 +50,6 @@
}
});
loginRequest.done(function(res, status, xhr) {
- alert("OK vvv");
window.location.reload();
});
loginRequest.fail(function(xhr, status, error) {
@@ -65,7 +68,6 @@
url : 'out' // This is a URL on your website.
});
logoutRequest.done(function(res, status, xhr) {
- alert("Logout OK");
window.location.reload();
});
logoutRequest.fail(function(xhr, status, error) {
View
8 src/main/java/info/modprobe/browserid/BrowserIDResponse.java
@@ -13,16 +13,12 @@
* availability depend on its value.
*
*
- * @see <a
- * href="https://developer.mozilla.org/en/Persona/Remote_Verification_API"
- * >Persona's <i>Remote Verification API</i> </a>
+ * @see <a href="https://developer.mozilla.org/en/Persona/Remote_Verification_API"> Persona's <i>Remote Verification API</i> </a>
*
*
* <br/>
* <br/>
- * The majority of the code on this class has been borrowed from <a href=
- * "https://github.com/mozilla/browserid-cookbook/blob/109ff3f1446ce3f28bdb09bf500749a6fa4cca55/java/spring/src/pt/webdetails/browserid/BrowserIdResponse.java"
- * > Mozilla's browser-id cook book BrowserIdResponse</a> class
+ * The majority of the code on this class has been borrowed from <a href="https://github.com/mozilla/browserid-cookbook/blob/109ff3f1446ce3f28bdb09bf500749a6fa4cca55/java/spring/src/pt/webdetails/browserid/BrowserIdResponse.java">Mozilla's browser-id cook book BrowserIdResponse</a> class
*/
public class BrowserIDResponse {
View
5 src/main/java/info/modprobe/browserid/Verifier.java
@@ -20,9 +20,8 @@
* Simple client for a BrowserID verify call.
*
* <br/>
- * The majority of the code on this class has been borrowed from <a href=
- * "https://github.com/mozilla/browserid-cookbook/blob/109ff3f1446ce3f28bdb09bf500749a6fa4cca55/java/spring/src/pt/webdetails/browserid/BrowserIdVerifier.java"
- * > Mozilla's browser-id cook book BrowserIdVerifier</a> class
+ * The majority of the code on this class has been borrowed from <a href="https://github.com/mozilla/browserid-cookbook/blob/109ff3f1446ce3f28bdb09bf500749a6fa4cca55/java/spring/src/pt/webdetails/browserid/BrowserIdVerifier.java">
+ * Mozilla's browser-id cook book BrowserIdVerifier</a> class
*/
public class Verifier {
Please sign in to comment.
Something went wrong with that request. Please try again.