Skip to content

Commit

Permalink
Merge branch 'feature/shibui-1742' of bitbucket.org:unicon/shib-idp-u…
Browse files Browse the repository at this point in the history
…i into feature/shibui-1742
  • Loading branch information
rmathis committed Aug 20, 2021
2 parents 655d11f + f2b6975 commit e3dfc6e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ class DevConfig {
}, new Role().with {
name = 'ROLE_NONE'
it
}, new Role().with {
name = 'ROLE_ENABLE'
it
}]
roles.each {
roleRepository.save(it)
Expand Down Expand Up @@ -207,4 +210,4 @@ class DevConfig {
return it
})
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import edu.internet2.tier.shibboleth.admin.ui.security.springsecurity.AdminUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down Expand Up @@ -38,6 +37,9 @@
@ConditionalOnMissingBean(WebSecurityConfigurerAdapter.class)
public class WebSecurityConfig {

@Value("${shibui.roles.authenticated}")
private String[] acceptedAuthenticationRoles;

@Value("${shibui.logout-url:/dashboard}")
private String logoutUrl;

Expand Down Expand Up @@ -76,7 +78,7 @@ protected void configure(HttpSecurity http) throws Exception {
.and()
.authorizeRequests()
.antMatchers("/unsecured/**/*").permitAll()
.anyRequest().hasAnyRole("USER", "ADMIN")
.anyRequest().hasAnyRole(acceptedAuthenticationRoles)
.and()
.exceptionHandling().accessDeniedHandler((request, response, accessDeniedException) -> response.sendRedirect("/unsecured/error.html"))
.and()
Expand Down Expand Up @@ -157,5 +159,4 @@ public void configure(WebSecurity web) throws Exception {
}
};
}
}

}
5 changes: 5 additions & 0 deletions backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spring.datasource.platform=h2
spring.datasource.driverClassName=org.h2.Driver
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true
spring.h2.console.settings.web-allow-others=true

# spring.jackson.default-property-inclusion=non_absent
spring.jackson.default-property-inclusion=NON_NULL
Expand Down Expand Up @@ -87,7 +88,11 @@ shibui.mail.text-email-template-path-prefix=/mail/text/
shibui.mail.html.email-template-path-prefix=/mail/html/
shibui.mail.system-email-address=doNotReply@shibui.org


#ShibUIConfiguration slurps in these values and they are bootstrapped in on startup
shibui.roles=ROLE_ADMIN,ROLE_ENABLE,ROLE_USER,ROLE_NONE
#Authenticated access roles - used by Spring Security to allow access when authenticated
shibui.roles.authenticated=ADMIN,ENABLE,USER

#In order to enable authentication via configured pac4j library (with external SAMl Idp, for example)
#This property must be set to true and pac4j properties configured. For sample pac4j properties, see application.yml
Expand Down

0 comments on commit e3dfc6e

Please sign in to comment.