Posts

Showing posts from July, 2018

Using OAuth2 in Spring Boot App with {okta}

Image
Add the following dependencies in POM file <dependency>     <groupId>com.okta.spring</groupId>     <artifactId>okta-spring-boot-starter</artifactId>     <version>0.2.0</version> </dependency>         <dependency>             <groupId>org.springframework.security.oauth</groupId>             <artifactId>spring-security-oauth2</artifactId>             <version>2.2.0.RELEASE</version>         </dependency> In spring boot main class add the following Bold and Underlined code            import org.springframework.boot.autoconfigure.SpringBootApplication;             import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;           @EnableResourceServer          @SpringBootApplication         public class DemoApplication {            public static void main(String[] args) {                    S

No 'Access-Control-Allow-Origin' header is present on the requested resource

NOTE: This is not a fix for production or when application has to be shown to the client, this is only helpful when UI and Backend   development   are on different   servers   and in production they are actually on same server. For example: While developing UI for any application if there is a need to test it locally pointing it to backend server, in that scenario this is the perfect fix.   For production fix, CORS headers has to be added to the backend server to allow cross origin access. The easy way is to just add the extension in google chrome to allow access using CORS. ( https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en-US ) Just enable this extension whenever you want allow access to no  'access-control-allow-origin' header request. Or In Windows, paste this command in  run  window chrome . exe -- user - data - dir = "C:/Chrome dev session" -- disable - web - security this will open a new

Maven Proxy setting issues for NTLM Proxy Users

Image
Follow the following steps and the problem would be resolved. 1. Download and install cNTLM for windows. 2. Configure cNTLM as shown below: Open cntlm.ini configuration file. Configure cntlm.ini file Set user name. Set domain name Set user's password. Set Proxy IP and Port. Note down Listen port to set in maven's settings.xml file. Now save and close cntlm.ini file. 3. Open maven settings.xml file and set proxy settings as follows:     <settings>        <proxies>              <proxy>                     <active>true</active>                     <protocol>http</protocol>                     <host> 127.0.0.1 </host>                     <port> 3128 </port>                     <username></username>                    <password></password>                    <nonProxyHosts></nonProxyHosts>             </proxy>       </p