0.3.0 • Published 6 years ago

vue-spring-security v0.3.0

Weekly downloads
9
License
MIT
Repository
-
Last release
6 years ago

vue-spring-security

A component library to secure the front end of a Vue.js app using the grails-spring-security-rest plugin. It is based on the grails security tag-lib.

Install

NPM

npm install vue-spring-security
#or
yarn add vue-spring-security

Unpkg

If inluced via this method the components will automatically install itself.

Importing

You can import the components as follows

import SecIfAllGranted from 'vue-spring-security'

Component API

Props

NameTypeRequiredDescription
userObjecttrueAn object representing the currently logged in user whose authorization you want to manage. Object should contain an authorities property. user: { authorities: ['ROLE_USER'] }
rolesArraytrueAn array of roles that should be tested against the user's authorities

Components

1. IfAllGranted

Shows the nested content if the user has all the specified roles.

<sec-if-all-granted :user="user" :roles="roles">
  <p>Stuff to show if user has all roles</p>
</sec-if-all-granted>

2. IfAnyGranted

Shows the nested content if the user has any of the specified roles.

<sec-if-any-granted>
  <p>Stuff to show if user has any of the roles</p>
</sec-if-any-granted>

3. IfNotGranted

Shows the nested content if the user does not have any of the nested roles.

<sec-if-not-granted>
 <p>Shown if user does not have any of the stated rows</p>
</sec-if-not-granted>

Example

The lib-dev.vue component shows an example of how to use the components. It can be run via the service global addon from Vue CLI which allows for rapid propotyping during development.

 vue serve src/lib-dev.vue
0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago