An open API service indexing awesome lists of open source software.

https://github.com/mcroteau/parakeet

A Small J2ee Security Framework / Plugin.
https://github.com/mcroteau/parakeet

parakeet security servlet spring

Last synced: 10 days ago
JSON representation

A Small J2ee Security Framework / Plugin.

Awesome Lists containing this project

README

          

Parakeet
======

Parakeet is a small J2ee Open Source security framework / plugin that boasts quick easy setup.

#### Installation

Add dependency:

```

xyz.goioc
parakeet
0.10

```

Update `web.xml`, add ParakeetFilter:

```

Parakeet
perched.support.filters.ParakeetFilter

Parakeet
/*

```

Create an `Accessor`, the class
which provides data to Parakeet.

Example:

```
package perched.support.accessor;

import Accessor;
import org.springframework.beans.factory.annotation.Autowired;
import xyz.goioc.dao.AccountDao;
import xyz.goioc.model.Account;

import qio.annotate.Inject;

import java.util.Set;

public class JdbcAccessor implements Accessor {

@Inject
AccountDao accountDao;

public String getPassword(String user){
String password = accountDao.getAccountPassword(user);
return password;
}

public Set getRoles(String user){
Account account = accountDao.findByUsername(user);
Set roles = accountDao.getAccountRoles(account.getId());
return roles;
}

public Set getPermissions(String user){
Account account = accountDao.findByUsername(user);
Set permissions = accountDao.getAccountPermissions(account.getId());
return permissions;
}

}
```

Add Cookie xml declaration just in case the container
doesn't pick up the cookie on authentication. Add to the **web.xml**

```

COOKIE

```

Then somewhere in your project during startup call `.configure()` passing
in the JdbcAccessor.

```
Parakeet.configure(jdbcAccessor)
```

### Parakeet has your JdbcAccessor and your project is configured.

Now you can use can authenticate your user via :

`Parakeet.login()`

You'll have access to the following methods:

`Parakeet.isAuthenticated()`

`Parakeet.hasRole(role)`

`Parakeet.hasPermission(permission)`

To log out:

`Parakeet.logout()`

### See, we told you it was short!

Oh, we added something new. Taglibs:

You can now check authentication, and get user info
within jsp without scriptlets.

**First include tag reference:**

`<%@ taglib prefix="parakeet" uri="/META-INF/tags/parakeet.tld"%>`

**3 available tags:**

Displays when user is anonymous & not authenticated

``

Displays content only when user is authenticated

``

Displays username

``

A very basic sample servlet app can be viewed within
the project under `sample-web`

If you want a more, we recommend Apache Shiro! It's a Bull Dog.