Skip to content

Commit

Permalink
fixed paths in index etc
Browse files Browse the repository at this point in the history
  • Loading branch information
andrebiegel committed Aug 16, 2017
1 parent c0fa890 commit 79ef224
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
11 changes: 0 additions & 11 deletions src/main/java/de/abiegel/jaxrs/auth/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,4 @@
@ApplicationPath("app")
public class App extends Application {

@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> res = new HashSet<>();
res.add(LoginResource.class);
res.add(SecuredResource.class);
res.add(JwtSecuredFilter.class);


return res;
}

}
2 changes: 1 addition & 1 deletion src/main/java/de/abiegel/jaxrs/auth/LoginResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private String issueTokenFor(String user) {


private void authenticateUser(String user, String password) {
if ("42".equals(password)) {
if (!"42".equals(password)) {
throw new SecurityException("no access bro");
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/webapp/WEB-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
bean-discovery-mode="all" version="1.1"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd">

Expand Down
10 changes: 5 additions & 5 deletions src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
<body>
<h1>Auth Example - JAX-RS and JWT</h1>

<a href="api/echo?message=hello">Echo hello</a><br/>
<a href="api/echo/jwt?message=hello">JWT Echo hello (does not work if no JWT token)</a><br/>
<a href="api/users">Get all Users</a><br/>
<a href="api/users/7c0481a08abe0ca9d96757d281fffc3021c53att">Get user by id</a><br/>
<a href="app/hello?message=hello">Echo hello</a><br/>
<a href="app/hello/secured?message=hello">JWT Echo hello (does not work if no JWT token)</a><br/>
<a href="app/users">Get all Users</a><br/>
<a href="app/users/7c0481a08abe0ca9d96757d281fffc3021c53att">Get user by id</a><br/>

<h2>Login</h2>
Try user/password user/42<br/><br/>
<form method="post" enctype="application/x-www-form-urlencoded" action="api/login">
<form method="post" enctype="application/x-www-form-urlencoded" action="app/login">
Login: <input type="text" name="login"><br/>
Password: <input type="text" name="password"><br/>
<input type="submit" name="Login"/>
Expand Down

0 comments on commit 79ef224

Please sign in to comment.