• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

J2C Authentication Data

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying read the J2C Authentication Alias (UserId & Password) from my servlet. I am using RAD 7 and built-in WAS 6.1 server.

I created the J2C authentication entry called testAlias.

Secure administration, applications, and infrastructure > JAAS - J2C authentication data. I saw WAS 6.1 added prefix(node name) for the alias I created like this:

nodeName/testAlias

When I tried to look up this alias using InitialContext, i keep getting the following error:

Here is the code to look up the Alias

InitialContext ctx = new InitialContext();
String str = (String) ctx.lookup("an27808Node02/testAlias");


7/16/08 14:50:17:018 CDT] 00000024 SystemErr R javax.naming.NameNotFoundException: Context: an27808Node02Cell/nodes/an27808Node02/servers/server1, name: an27808Node02/testAlias: First component in name an27808Node02/testAlias not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/NamingContext/NotFound:1.0]
[

Any help will be greatly appreciated...
 
hyongil moon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found an example of code fragment how to store User id and password securely in Application Server configuration file which can be used by an application running on Application Server.

HashMap map = new HashMap();
map.put("com.ibm.mapping.authDataAlias", j2cAlias);
WSMappingCallbackHandler callbackHandler = new WSMappingCallbackHandler(map, null);
LoginContext lc = new LoginContext("DefaultPrincipalMapping", callbackHandler);
lc.login();

The problem is when I tested in RAD 7, it works great but with WSAD 5.1.2, I am getting the following error:

"WSMappingCallbackHandler cannot be resolved or is not a type"

It looks like WSMappingCallbackHandler is part of IBM WebSphere Application Server, Release 6 API not 5.

Any idea how I can do this in WSAD 5.1.2 with WAS 5.0.2??

Thanks,
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I managed to read username and password through java code from J2C authentication. But password is in encrypted format, any idea how can i get the decrypted password using java code?

I thhink they are using XOR encryption.

Any help would be appreciated

Thanks,
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


You can try this:


com.ibm.ws.security.core.SecurityConfig securityConfig = com.ibm.ws.security.core.SecurityConfig.getConfig();
Properties authProperties = securityConfig.getAuthData("jaasAliasName");
String id= authProperties.getProperty("username");
String pwd= authProperties.getProperty("password");
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chethan Verma,

will the above code snippet works for WAS 7? Can you please let me know if i need to add anything to make it work in WAS7.
where can i get com.ibm.ws.security.core.SecurityConfig class?


Thanks in advance.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepa Subramaniam wrote:Hi,

I managed to read username and password through java code from J2C authentication. But password is in encrypted format, any idea how can i get the decrypted password using java code?

I thhink they are using XOR encryption.

Any help would be appreciated

Thanks,



Please post the code for getting encrypting password
 
get schwifty. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic