JAAS LOGIN IN WEBLOGIC SERVER--reference
The Java Authentication and Authorization Service (JAAS) is a standard extension to the security in the J2SE Development Kit 5.0. JAAS provides the ability to enforce access controls based on user identity. JAAS is provided in WebLogic Server as an alternative to the JNDI authentication mechanism.
WebLogic Server clients use the authentication portion of the standard JAAS only. The JAAS LoginContext provides support for the ordered execution of all configured authentication provider LoginModule instances and is responsible for the management of the completion status of each configured provider.
//JAASLogin.java import javax.security.auth.Subject;
import javax.security.auth.callback.*;
import javax.security.auth.login.*; import weblogic.security.auth.callback.URLCallback; public class JAASLogin
{
private static final class ConfigInfo
{
static String USERID = “weblogic”;
static String PASSWORD = “weblogic”;
static String URL = “t3://10.10.71.79:7001?;
static String JAAS_STRING = “other”; } public static void main(String[] args)
{ try{
System.out.println(“Server is at ” + ConfigInfo.URL);
System.out.println(“Userid: ” + ConfigInfo.USERID);
System.out.println(“Password: ” + ConfigInfo.PASSWORD);
LoginContext lc = new LoginContext(ConfigInfo.JAAS_STRING, new JAASLogin.CallbackHandler(ConfigInfo.USERID, ConfigInfo.PASSWORD, ConfigInfo.URL));
System.out.println(“LoginContext:: “);
lc.login();
System.out.println(“lc.login():: “);
Subject subject = lc.getSubject();
System.out.println(“Subject: ” + subject);
}
catch(AccountExpiredException ae){ ae.printStackTrace();
}
catch(CredentialExpiredException ce){ ce.printStackTrace();
}
catch(FailedLoginException fe){ fe.printStackTrace();
}
catch(LoginException le){ le.printStackTrace();
} } private static final class CallbackHandler implements javax.security.auth.callback.CallbackHandler
{
private String userid;
private String password;
private String url; public CallbackHandler(String userid, String password, String url)
{
this.userid = userid;
this.password = password;
this.url = url;
}
public void handle(Callback[] callbacks) throws UnsupportedCallbackException
{
for (int i = 0; i < callbacks.length; i++)
{
if (callbacks[i] instanceof TextOutputCallback)
{
TextOutputCallback toc = (TextOutputCallback)callbacks[i];
System.err.println(“JAAS callback: ” + toc.getMessage());
}
else if (callbacks[i] instanceof NameCallback)
{
NameCallback nc = (NameCallback)callbacks[i];
nc.setName(userid);
}
else if (callbacks[i] instanceof PasswordCallback)
{
PasswordCallback pc = (PasswordCallback)callbacks[i];
pc.setPassword(password.toCharArray());
}
else if (callbacks[i] instanceof weblogic.security.auth.callback.URLCallback)
{
URLCallback uc = (URLCallback)callbacks[i];
uc.setURL(url);
}
else
{
System.out.println(callbacks[i] + ” Unrecognized Callback”);
throw new UnsupportedCallbackException(callbacks[i], “Unrecognized Callback”);
}
}
}
}
}
JAAS LOGIN IN WEBLOGIC SERVER--reference的更多相关文章
- WebLogic Server的单点登陆功能--转载
在WebLogic 8.1最新的 SP4版本中,最引人注目的要算是在安全方面,提供了用于和Microsoft Windows客户端进行Single Sign-On的Single Pass Negoti ...
- WebLogic Server的Identity Assertion--转载
在一些典型的公司Web应用程序安全部署中,访问受保护应用程序的用户通过企业身份/访问管理产品,如Netegrity 的 SiteMinder,IBM 的WebSEAL 和Oblix 的 Oblix C ...
- --BEA官方网站(http: //www.bea.com)甲骨文已完成对该公司的收购BEA Weblogic Server 7.0x应用服务器简明安 装、配置手册 1
====================简 介: BEA公司是业内著名的中间件产商,以Tuxedo及Weblogic闻名于世,而其基础件平台(infrastructure)Weblogic platf ...
- WebLogic Server
前几天,看了几集J2ee , 给我的感觉就是,看不懂!! 一点也不懂! 那怎么办呢? 听老师的,不管懂不懂,先看看再说.接下来,就开始了J2ee "艰苦"的历程.在J2ee中,经常 ...
- How to find Oracle EBS Weblogic Server Admin Port and URL
How to find Oracle EBS Weblogic Server Admin Port and URL Weblogic admin portMethod 1 Open the App ...
- WebLogic Server官方下载地址
WebLogic Server官方下载地址 英文(更新到12c和9.2.4):http://www.oracle.com/technetwork/middleware/ias/downloads/wl ...
- BEA WebLogic Server 10 查看和配置日志
查看和配置日志 WebLogic Server 内的每个子系统都可生成日志消息来传达其状态.例如,当启动 WebLogic Server 实例时,安全子系统会输出消息以报告其初始化状态.为了记录其子系 ...
- 关于Weblogic Server(介绍)
Weblogic, 美国Oracle公司名下产品,是一个基于 J2EE 架构.可扩展的应用服务器. 本文档选取部分官方文档翻译 总览 支持多种类型的分布式应用 基于 SOA 应用的理想架构 完整实现 ...
- J2EE之WebLogic Server
WebLogic是用于开发.集成.部署和管理大型分布式Web应用. 网络应用和数据库应 用的Java应用server. 将Java的动态功能和Java Enterprise标准的安全性引入大型网络应用 ...
随机推荐
- Mvc基础(1)
- bzoj 3781: 小B的询问 分块
3781: 小B的询问 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 196 Solved: 135[Submit][Status] Descrip ...
- Java线程监听,意外退出线程后自动重启
Java线程监听,意外退出线程后自动重启 某日,天朗气清,回公司,未到9点,刷微博,顿觉问题泛滥,惊恐万分! 前一天写了一个微博爬行程序,主要工作原理就是每隔2分钟爬行一次微博,获取某N个关注朋友微博 ...
- 一周一话题之四(JavaScript、Dom、jQuery全面复习总结<js篇>)
-->目录导航 一. JavaScript 1. js介绍 2. js语法 3. js进阶 4. js高级 5. 事例代码下载 一. JavaScript 做BS系统,JavaScript的使用 ...
- sqlite的源代码加密,以及其它一些文章
一. 给数据库加密 前面所说的内容网上已经有很多资料,虽然比较零散,但是花点时间也还是可以找到的.现在要说的这个——数据库加密,资料就很难找.也可能是我操作水平不够,找不到对应资料.但不管 ...
- fuser可以用于系统安全检查。
fuser可以用于系统安全检查.用fuser查看哪些用户和进程在某些地方作什么:fuser -cu /root 简略显示fuser -muv /mnt3 分列显示
- 用C#中的params关键字实现方法形参个数可变
个人认为,提供params关键字以实现方法形参个数可变是C#语法的一大优点.在方法形参列表中,数组类型的参数前加params关键字,通常可以在调用方法时代码更加精练. 例如,下面代码: class P ...
- 转载--C语言运算符优先级和口诀
转载:http://www.cnblogs.com/zhanglong0426/archive/2010/10/06/1844700.html 一共有十五个优先级: 1 () [] . -& ...
- Team Foundation Server操作说明
目录 一. Visual Studio 2010团队协作管理 1.1团队模型及角色 1.1.1创建角色 1.1.2创建工作组 1.1.3工作组成员及权限 1.2团队成员利用VS2010实现协同办公 1 ...
- 《C语言程序设计现代方法》第4章 编程题
1 编写一个程序,要求用户输入一个两位数,然后按数位的逆序打印出这个数. 方法一:没技术含量的 #include <stdio.h> int main() { int high, low; ...