Browse Source

Implement BookStoreAuthorities class

Signed-off-by: Pekka Helenius <fincer89@hotmail.com>
v0.0.3-alpha
Pekka Helenius 4 years ago
parent
commit
2a525f3136
1 changed files with 41 additions and 0 deletions
  1. +41
    -0
      bookstore/src/main/java/com/fjordtek/bookstore/service/session/BookStoreAuthorities.java

+ 41
- 0
bookstore/src/main/java/com/fjordtek/bookstore/service/session/BookStoreAuthorities.java View File

@ -0,0 +1,41 @@
//Pekka Helenius <fincer89@hotmail.com>, Fjordtek 2020
package com.fjordtek.bookstore.service.session;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
/**
*
* This class gets Spring Environment key property values from
* Spring property sources and inserts them into publicly
* accessible class attributes.
* <p>
* The attribute values of this class are primarily used,
* for instance, within @PreAuthorize annotations.
*
* @author Pekka Helenius
*/
@Component("BookAuth")
public class BookStoreAuthorities {
@Autowired
private Environment env;
public String ADMIN, HELPDESK, SALES, USER;
@PostConstruct
private void constructAuthorities() {
this.ADMIN = env.getProperty("auth.authority.admin");
this.HELPDESK = env.getProperty("auth.authority.helpdesk");
this.SALES = env.getProperty("auth.authority.sales");
this.USER = env.getProperty("auth.authority.user");
}
}

Loading…
Cancel
Save