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.
- Host: GitHub
- URL: https://github.com/mcroteau/parakeet
- Owner: mcroteau
- License: mit
- Created: 2020-08-18T02:30:12.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-15T18:25:04.000Z (about 4 years ago)
- Last Synced: 2025-08-13T13:04:04.921Z (6 months ago)
- Topics: parakeet, security, servlet, spring
- Language: Java
- Homepage: https://github.com/mcroteau/Parakeet
- Size: 189 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License.md
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.