Skip to content

Commit

Permalink
Whitelisted secretary pages
Browse files Browse the repository at this point in the history
  • Loading branch information
rudasrudas committed Jun 1, 2021
1 parent cf1bd49 commit 7941772
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 38 deletions.
41 changes: 4 additions & 37 deletions src/main/java/com/cpd/coronapreventiondivision/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,6 @@
@Configuration
@EnableWebSecurity
public class AppConfig extends WebSecurityConfigurerAdapter {
// @Override
// protected void configure(HttpSecurity http) throws Exception {
// http.cors().and().csrf().disable();
// http.authorizeRequests()
//// .antMatchers("")
// .anyRequest()//allow all urls
////// .authenticated()//all URLs are allowed by any authenticated user, no role restrictions.
//// .and()
//// .formLogin()//enable form based authentication
//// .loginPage("/my-login")//use a custom login URI
//// .permitAll(true)//login URI can be accessed by anyone
//// .and()
//// .logout()//default logout handling
//// .logoutSuccessUrl("/my-login?logout")//our new logout success url, we are not replacing other defaults.
// .permitAll();//allow all as it will be accessed when user is not logged in anymore
// }

//This allows only specific pages to be accessed without logging in
@Override
Expand All @@ -49,29 +33,10 @@ public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/get-google-maps-link");
web.ignoring().antMatchers("/get-available-times");
web.ignoring().antMatchers("/get-available-days");
web.ignoring().antMatchers("/get-center-appointments");
web.ignoring().antMatchers("/update-appointment-report");
}

// @Override
// public void configure(AuthenticationManagerBuilder builder)
// throws Exception {
// builder.inMemoryAuthentication()
// .withUser("joe")
// .password("123")
// .roles("ADMIN");
// }

// @Bean
// WebMvcConfigurer myWebMvcConfigurer() {
// return new WebMvcConfigurerAdapter() {
//
// @Override
// public void addViewControllers(ViewControllerRegistry registry) {
// ViewControllerRegistration r = registry.addViewController("/my-login");
// r.setViewName("my-login-page");
// }
// };
// }

@Autowired
private DataSource dataSource;

Expand All @@ -92,6 +57,8 @@ protected void configure(HttpSecurity http) throws Exception {
.antMatchers("/update-center").hasAuthority("ADMIN")
.antMatchers("/submit-center").hasAuthority("ADMIN")
.antMatchers("/secretary").hasAuthority("SECRETARY")
.antMatchers("/get-center-appointments").hasAuthority("SECRETARY")
.antMatchers("/update-appointment-report").hasAuthority("SECRETARY")
.antMatchers("/**").permitAll()
.and()
.formLogin().permitAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h1 class="title" style="margin-bottom: 0px; margin-top: 20px;">Secretary Dashbo
<!-- <td th:text="${appointment.time}"></td>-->
<!-- <td th:text="${appointment.patient.getCPR()}"></td>-->
<!-- <td>-->
<!--

<!-- </td>-->
<!-- </tr>-->
<!-- </th:block>-->
Expand Down

0 comments on commit 7941772

Please sign in to comment.