angad jha

Greenhorn
+ Follow
since Dec 26, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by angad jha


2
down vote
favorite
We currently have 4 Spring applications that use Spring Security Oauth2 project for authentication. The applications are REST APIs that are consumed by other internal applications in the company I work for.

Everything was working fine in the development and QA environments as we were not doing load balancing, now that we are in pre-production we are facing an issue with the load balancer (LB).

This is the workflow for this issue:

Client sends request for the oauth token
LB redirects the request to Box 1
Box 1 authenticates and returns a valid Bearer Token
Client receives the token and store it for using through the sesion
Client sends request for a service in the REST API adding the previously retrieved token to the headers
LB redirects the request to Box 2
Box 2 fails to authenticate as it does not recognize the token and returns an Invalid Credentials response
We are using an in memory user store:

<bean id="tokenStore" class="org.springframework.security.oauth2.provider.token.InMemoryTokenStore" />

Is there a way to make different boxes to share the same token store? I know there is a JdbcTokenStore that can be used to persist tokens to the db, but I would prefer to avoid persisting tokens as these applications point to a legacy database that only stores business information.


6 years ago
Hello Guys,

I need a favor in SQLite integration with java, I have configured DB with Java. Now I want to set the password in DB file.
I tried to google search but did not get any solution.

Thanks
7 years ago
Hello guys

I need favor for Linkedin login integration in Spring boot application.
Can you refer me link for integration.

thanks
8 years ago
Hello guys

I'm developing upload profile pic functionality in Spring mvc application,
while upload image, it is saving in my local directory, now I set image path from local machine
it does not show image, in firebug it shows failed to load the given Url.
and my image source path looks like
<img width="100" height="100" alt="Upload Image" src="C:\test111\Desert.jpg" style="border-color: red; border: 1px solid;">

please suggest me solution why is not showing image on page,

thanks
8 years ago
Hello Guys

I have employee form and I need to submit details using ajax,
and I made submitForm method in controller, and this controller return Employee Form page and this page has other extra fields for employee,
So this is what i have done,
So i need to know how to submit form using ajax, and i dont want use json as response boby , is it possible ?

please give me solution


8 years ago
Hi

I want show data something like that
(http://javakafunda.blogspot.in/2014/08/how-to-create-multi-level-menus-using.html)
and data should be come form table.
I did like below :
for(MenuTO m: menuList){
System.out.println(m.getMenuTitle());
printChilds(m);
model.addAttribute("menuList", menuList);
}

private void printChilds(MenuTO m){
if(m.getChilds() !=null){
for(MenuTO mmd:m.getChilds()){
System.out.println(mmd.getMenuTitle());
printChild(mmd);
}
}
}

Now I need to show on JSP ,
I'm using Spring MVC
8 years ago
hello guys

I need help for creating Menu and sub menu bar using table from database ,
Menu and sub menu should be dynamically add,
I'm using Spring MVC with Hibernate

thanks
8 years ago
Hello guys

I'm making an application which will use encrypt data password from iOS , Now I need to decrypt password and validate password in java server code,
So for Encryption and Decryption I'm using JNCryptor , uses link https://github.com/RNCryptor/JNCryptor
Note : Encrypt data is working and I'm getting problem with decryptData.
Here below I shared code,

public class SecurityJNCryptor {

byte[] salt = new String("12345678").getBytes();
static final String HMAC_ALGORITHM = "HmacSHA256";
byte[] hmac = new String(HMAC_ALGORITHM).getBytes();
static String pass = "Java@123";
SecretKey decryptionKey;
SecretKey hmacKey;


public SecurityJNCryptor() throws InvalidKeySpecException, CryptorException{
AES256JNCryptor aesCiphertext = new AES256JNCryptor();
decryptionKey = aesCiphertext.keyForPassword(pass.toCharArray(), salt);
hmacKey = aesCiphertext.keyForPassword(pass.toCharArray(), hmac);

}


public String encriptorData(String password){
byte [] cipher = null;
String base64EncryptedData = null;
AES256JNCryptor cryptor = new AES256JNCryptor();
byte[] plaintext = "Hello , World!".getBytes();
try{
cipher = cryptor.encryptData(plaintext, password.toCharArray());
System.out.println(cipher);
base64EncryptedData = new sun.misc.BASE64Encoder().encodeBuffer(cipher);
System.out.println("Encrypted Data " + base64EncryptedData);

}catch(CryptorException exception){

}
return base64EncryptedData;

}

public String decryptData(String data) throws InvalidHMACException, CryptorException{
byte [] cipher = null;
AES256JNCryptor cryptor = new AES256JNCryptor();
cipher = cryptor.decryptData(data.getBytes(), decryptionKey , hmacKey);
return Base64.encode(cipher);

}

public static void main(String[] args) throws InvalidKeySpecException, InvalidHMACException, CryptorException {
SecurityJNCryptor decryptor = new SecurityJNCryptor();
String a = decryptor.encriptorData(pass);
String b = decryptor.decryptData(a);
System.out.println(b);

}

while running this code I'm getting below exception.
Exception in thread "main" java.lang.IllegalArgumentException: Salt value must be 8 bytes.
at org.cryptonode.jncryptor.Validate.isTrue(Validate.java:27)
at org.cryptonode.jncryptor.AES256JNCryptor.keyForPassword(AES256JNCryptor.java:156)
at com.playstore.util.SecurityJNCryptor.<init>(SecurityJNCryptor.java:27)
at com.playstore.util.SecurityJNCryptor.main(SecurityJNCryptor.java:59)

9 years ago
Sorry for Confusion, let me explain.
actually I'm making admin page in server code , So I want value like above formate, it's not compulsory for value with WSDL.
I need only available webservices,
do you have any suggestion for getting all Available RESTful services:
on jsp page,
9 years ago
No, I'm using RESTFul webservice
JAX-RS implementation
9 years ago
Hello Guys

I need a favor regarding some functionality.
I'm making a webservice using Apache CXF, I have done also client side code for using created webservice.
Now I want shows all listed web services operations in jsp page, in server side code, using spring controller.
listed service should have some information like below:
1: Service Overview
2: SID information
3: WSDL API
4: WSDL Definition

thanks


9 years ago
Hi Guys
I'm creating a website using Spring MVC. let you know what I have done.
1: I created App, and got API Id, API version, and App Secret Code,
2: Now I configured all details in our code.
3: Login functionality is working fine and for fetching user data I'm using https://graph.facebook.com/v2.5/me?" + accessToken;
Now the problem is below.
1: I'm getting only two details from graph , like {"name":"Angad Jha","id":"1004851352898414"}.but I need also other data like gender , email, date of birth etc.
2: please suggest me logout http url. and how to use logout url in java and redirect to login page.
Note: I don't want use java script FB.logout in our code.
9 years ago
Hello Guys.

I'm using Payment gateway in our Spring Application.
let you know what I have done.
1: I created two account in https://developer.paypal.com/
2: and then we got two email id *-buyer@gmail.com and *-facilator@gmail.com
3: Now for Integration We added paypal configuration in Web.xml like below:
<context-param>
<param-name>posturl</param-name>
<param-value>https://www.sandbox.paypal.com/cgi-bin/webscr</param-value>;
</context-param>

<context-param>
<param-name>cmd</param-name>
<param-value>_donations</param-value>
</context-param>

<context-param>
<param-name>business</param-name>
<param-value>abc-facilitator@gmail.com</param-value>
</context-param>

<context-param>
<param-name>password</param-name>
<param-value>TL45FT5EQWYGLB</param-value>
</context-param>

<context-param>
<param-name>signature</param-name>
<param-value>AFcWxV21C7fd0v3bYasdadsadORY4DvFa</param-value>
</context-param>

<context-param>
<param-name>returnurl</param-name>
<param-value>http://localhost:8080/paypal/success</param-value>;
</context-param>

<context-param>
<param-name>cancelurl</param-name>
<param-value>http://localhost:8080/paypal/cancel</param-value>;
</context-param>


4: Now I made donation form in JSP page

<form action="${initParam['posturl']}" method="post">
<!-- Saved buttons use the "secure click" command -->
<input type="hidden" name="cmd" value="${initParam['cmd']}"/>
<input type="hidden" name="business" value="${initParam['business']}"/>
<input type="hidden" name="password" value="${initParam['password']}"/>
<input type="hidden" name="cert_id" value="${initParam['signature']}" />
<!-- Saved buttons are identified by their button IDs -->
<input type="hidden" name="amount" value="30"/>
<!-- Saved buttons display an appropriate button image. -->
<input type="hidden" name="cancel_return" value="${initParam['cancelurl']}" />
<input type="hidden" name="return" value="${initParam['returnurl']}" />
<input type="submit" name="Donate" value="Donation" />
</form>


5 : then When I'm donating money after login with palpay then we are getting receipt in Paypal page , but I want my page will directly redirect to my Success page with Transaction value.
but It's not happening like that. Please favour me.

Thanks
AJ

9 years ago
Hello Guys

I want use free java web hosting. Is there any websites which are providing free java web hosting for some days without any cost ?.
b

Thanks
9 years ago
Yeah Stephan I know how to work with database. Actually I have not ever created EER model. So I was asking for guidance.
by the way I got my solution with example link http://www.databasezone.com/techdocs/DesigningTheCalendarHolidayDb.html .
I have gotten idea, how to categorize our schema.
let me know if you have any other guidance link.

Thank Stephan.