This file contains hidden or 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
public class OrientationSetter : MonoBehaviour | |
{ | |
private static IEnumerator SetupInitialOrientation() | |
{ | |
if (PlayerPrefsUtils.HasOrientation()) | |
{ | |
if (PlayerPrefsUtils.IsPortrait()) | |
{ | |
SetupPortraitOrientation(); | |
if (Screen.orientation != ScreenOrientation.Portrait) |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<parent> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-parent</artifactId> | |
<version>2.4.1</version> | |
<relativePath/> | |
</parent> |
This file contains hidden or 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
@RestController | |
@RequestMapping(path = "/zoo") | |
public class ZooController { | |
@PostMapping(path = "/add", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) | |
public String addAnimal(@RequestBody String payload) { | |
return "OK from post addAnimal"; | |
} | |
@GetMapping(path = "/all") |
This file contains hidden or 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
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-oauth2-client</artifactId> | |
</dependency> |
This file contains hidden or 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
@EnableConfigurationProperties(OneLoginConfigs.class) | |
@RequiredArgsConstructor(onConstructor_ = @Autowired) | |
@Configuration | |
public class SecurityConfiguration extends WebSecurityConfigurerAdapter { | |
private final OneLoginConfigs oneLoginConfigs; | |
@Override | |
public void configure(final HttpSecurity http) throws Exception { | |
http.authorizeRequests() |
This file contains hidden or 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
@Setter | |
@Getter | |
@ConfigurationProperties(prefix = "onelogin") | |
public class OneLoginConfigs { | |
private String clientId; | |
private String clientSecret; | |
} |
This file contains hidden or 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
--- | |
onelogin: | |
client-id: id | |
client-secret: secret |
This file contains hidden or 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
@RequiredArgsConstructor | |
public enum Role implements GrantedAuthority { | |
ADMIN(Code.ADMIN), | |
USER(Code.USER); | |
private final String authority; | |
@Override | |
public String getAuthority() { | |
return authority; |
This file contains hidden or 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
public class SecurityConfiguration extends WebSecurityConfigurerAdapter { | |
private static final String GROUPS = "groups"; | |
@Override | |
public void configure(final HttpSecurity http) throws Exception { | |
http.authorizeRequests() | |
.antMatchers("/", "/login**", "/oauth2/authorization/**").permitAll() | |
.antMatchers("/zoo/add/**").access("hasRole('ADMIN')") | |
.antMatchers("/zoo/all/**").access("hasAnyRole('ADMIN, USER')") | |
.anyRequest().authenticated() |
This file contains hidden or 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
@RestController | |
@RequestMapping(path = "/zoo") | |
public class ZooController { | |
@Secured(Role.Code.ADMIN) | |
@PostMapping(path = "/add", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) | |
public String addAnimal(@RequestBody String payload) { | |
return "OK from post addAnimal"; | |
} |