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
| /** | |
| * Example of Spring 4 Properties Java Configuration, | |
| * with a Database Properties table to store most values | |
| * and a small application.properties file too. | |
| * The Database table will take precedence over the properties file with this setup | |
| */ | |
| @Configuration | |
| @PropertySource(value = { "classpath:application.properties" }, ignoreResourceNotFound=true) | |
| public class SpringPropertiesConfig { | |
| private static final Logger log = LoggerFactory.getLogger(SpringPropertiesConfig.class); |
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
| ----- Interested Reads------ | |
| + Interesting Read (Serverless Architecture of Acloud guru) | |
| https://read.acloud.guru/serverless-the-future-of-software-architecture-d4473ffed864 | |
| ----- Getting Started------- | |
| + Requirements | |
| + AWS Free Tier Account | |
| + PC with putty and putty keygen/ Mac | |
| + Optional | |
| + IoS/ Android App $20 |
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
| package com.example; | |
| import org.springframework.web.bind.annotation.RequestMapping; | |
| import org.springframework.web.bind.annotation.RestController; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| @RestController | |
| @RequestMapping("/api") |
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
| import javax.validation.Constraint; | |
| import javax.validation.Payload; | |
| import java.lang.annotation.Retention; | |
| import java.lang.annotation.Target; | |
| import static java.lang.annotation.ElementType.FIELD; | |
| import static java.lang.annotation.ElementType.PARAMETER; | |
| import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| /** |
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
| How to Create Your YouTube API Credentials | |
| https://vidible.zendesk.com/hc/en-us/articles/207036056-How-to-Create-Your-YouTube-API-Credentials | |
| Creating your YouTube API Credentials is accomplished by performing to main stages: | |
| Stage I - Creating a Google OAuth 2.0 Web application client. | |
| Stage II - Creating a YouTube refresh token. | |
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
| // MyFilter.java | |
| public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { | |
| OutputStream out = response.getOutputStream(); | |
| ResponseWrapper wrapper = new ResponseWrapper((HttpServletResponse)response); | |
| chain.doFilter(request, wrapper); | |
| byte responseContent[] = wrapper.getData(); | |
| // Write copied response, should change whatever you want in 'responseContent' before sending to client | |
| out.write(responseContent); |
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
| http.addFilterBefore(customAuthFilter(), SecurityContextPersistenceFilter.class) | |
| .authorizeRequests() | |
| .antMatchers("/**") | |
| .authenticated() | |
| .and() | |
| .exceptionHandling().disable() | |
| .sessionManagement().disable() | |
| .rememberMe().disable() | |
| .x509().disable() | |
| .headers().disable() |
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
| @Configuration | |
| @EnableWebMvcSecurity | |
| public class WebSecurityConfig | |
| extends WebSecurityConfigurerAdapter { | |
| @Value("${oauth.check_token.url:http://localhost:3030/oauth/token/info}") | |
| private String checkTokenUrl; | |
| @Autowired @Qualifier("restTemplate") | |
| private RestOperations authRestTemplate; |
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
| @Configuration | |
| @EnableWebMvcSecurity | |
| public class WebSecurityConfig | |
| extends WebSecurityConfigurerAdapter { | |
| @Value("${oauth.check_token.url:http://localhost:3030/oauth/token/info}") | |
| private String checkTokenUrl; | |
| @Autowired @Qualifier("restTemplate") | |
| private RestOperations authRestTemplate; |
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
| package cz.monetplus.mac; | |
| import static org.assertj.core.api.Assertions.assertThat; | |
| import org.apache.commons.codec.binary.Hex; | |
| import org.bouncycastle.crypto.BlockCipher; | |
| import org.bouncycastle.crypto.Mac; | |
| import org.bouncycastle.crypto.engines.DESEngine; | |
| import org.bouncycastle.crypto.macs.ISO9797Alg3Mac; | |
| import org.bouncycastle.crypto.params.KeyParameter; |