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标准的安全性引入大型网络应用 ...
随机推荐
- [BZOJ 2738] 矩阵乘法 【分块】
题目链接:BZOJ - 2738 题目分析 题目名称 “矩阵乘法” 与题目内容没有任何关系..就像VFK的 A+B Problem 一样.. 题目大意是给定一个矩阵,有许多询问,每次询问一个子矩阵中的 ...
- Druid :大数据实时处理的开源分布式系统(1)
引言 Druid 是一个快速,近实时的查询海量只读数据的系统.Druid 的目标是可用性要达到100%,即使在部署新代码,或者某些节点 down 机的情况下. Druid 目前支持的单表查询方式和 D ...
- 【HDU 1133】 Buy the Ticket (卡特兰数)
Buy the Ticket Problem Description The "Harry Potter and the Goblet of Fire" will be on sh ...
- Aptana Studio 安装
Aptana Studio 是一个集成式的Web应用程序开发环境,它不仅可以作为独立的程序运行,而且还可以作为Eclipse插件使用. AptanaStudio是一个基于Eclipse的集成式Web开 ...
- Boostrap 模态框 水平垂直居中问题
var editorB = new UE.ui.Editor({ initialFrameHeight: 350, initialFrameWidth: 600 }); ...
- c#调用js,以及js调用C#里的函数, c#自己生成js代码,实现对web的控制
using mshtml;using System;using System.Collections.Generic;using System.Linq;using System.Security.P ...
- 《Gulp 入门指南》 : 使用 gulp 压缩 JS
<Gulp 入门指南> : 使用 gulp 压缩 JS 请务必理解如下章节后阅读此章节: 安装 Node 和 gulp 访问论坛获取帮助 压缩 js 代码可降低 js 文件大小,提高页面打 ...
- javascript时间、随机数
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Hadoop RPC简单实例
1.导入Hadoop-Common-2.6.0.jar导入工程,里面的IPC实现RPC需要的文件. 2.服务器端 (1)服务接口 package com.neu.rpc.server; /** * ...
- 《C语言程序设计现代方法》第4章 表达式
C语言的一个特点就是它更多地强调表达式而不是语句,表达式是表示如何计算值的公式. 当表达式包含两个或更多个相同优先级的运算符时,运算符的结合性(associativity)开始发挥作用.如果运算符是从 ...