-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor
- Loading branch information
Showing
11 changed files
with
100 additions
and
94 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...end/src/main/groovy/edu/internet2/tier/shibboleth/admin/ui/configuration/DevConfig.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.configuration | ||
|
||
import edu.internet2.tier.shibboleth.admin.ui.security.model.Role | ||
import edu.internet2.tier.shibboleth.admin.ui.security.model.User | ||
import edu.internet2.tier.shibboleth.admin.ui.security.repository.UserRepository | ||
import org.springframework.context.annotation.Profile | ||
import org.springframework.stereotype.Component | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
import javax.annotation.PostConstruct | ||
|
||
@Component | ||
@Profile('dev') | ||
class DevConfig { | ||
private final UserRepository adminUserRepository | ||
|
||
DevConfig(UserRepository adminUserRepository) { | ||
this.adminUserRepository = adminUserRepository | ||
} | ||
|
||
@Transactional | ||
@PostConstruct | ||
void createDevAdminUsers() { | ||
if (adminUserRepository.count() == 0) { | ||
def user = new User().with { | ||
username = 'admin' | ||
password = '{noop}adminpass' | ||
roles.add(new Role(name: 'ROLE_ADMIN')) | ||
it | ||
} | ||
|
||
adminUserRepository.save(user) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
.../java/edu/internet2/tier/shibboleth/admin/ui/security/repository/AdminRoleRepository.java
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
.../java/edu/internet2/tier/shibboleth/admin/ui/security/repository/AdminUserRepository.java
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
.../main/java/edu/internet2/tier/shibboleth/admin/ui/security/repository/RoleRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.security.repository; | ||
|
||
import edu.internet2.tier.shibboleth.admin.ui.security.model.Role; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* Spring Data repository to manage entities of type {@link Role}. | ||
* | ||
* @author Dmitriy Kopylenko | ||
*/ | ||
public interface RoleRepository extends JpaRepository<Role, Long> { | ||
|
||
Optional<Role> findByName(final String name); | ||
} |
16 changes: 16 additions & 0 deletions
16
.../main/java/edu/internet2/tier/shibboleth/admin/ui/security/repository/UserRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.security.repository; | ||
|
||
import edu.internet2.tier.shibboleth.admin.ui.security.model.User; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* Spring Data repository to manage entities of type {@link User}. | ||
* | ||
* @author Dmitriy Kopylenko | ||
*/ | ||
public interface UserRepository extends JpaRepository<User, Long> { | ||
|
||
Optional<User> findByUsername(String username); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Security | ||
|
||
Security in the system is controlled by Spring Security. | ||
|
||
Currently, the following roles are recognized: | ||
|
||
1. `ADMIN` | ||
1. `USER` |