Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
28e4321a
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
28e4321a
编写于
10月 22, 2013
作者:
C
chegar
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
ca041c9c
76310d8b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
48 deletion
+54
-48
src/share/classes/javax/security/auth/Policy.java
src/share/classes/javax/security/auth/Policy.java
+31
-24
src/share/classes/javax/security/auth/login/Configuration.java
...hare/classes/javax/security/auth/login/Configuration.java
+23
-24
未找到文件。
src/share/classes/javax/security/auth/Policy.java
浏览文件 @
28e4321a
...
...
@@ -26,6 +26,10 @@
package
javax.security.auth
;
import
java.security.Security
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.security.PrivilegedExceptionAction
;
import
java.util.Objects
;
import
sun.security.util.Debug
;
/**
...
...
@@ -155,22 +159,15 @@ import sun.security.util.Debug;
public
abstract
class
Policy
{
private
static
Policy
policy
;
private
static
ClassLoader
contextClassLoader
;
private
final
static
String
AUTH_POLICY
=
"sun.security.provider.AuthPolicyFile"
;
private
final
java
.
security
.
AccessControlContext
acc
=
java
.
security
.
AccessController
.
getContext
();
// true if a custom (not AUTH_POLICY) system-wide policy object is set
private
static
boolean
isCustomPolicy
;
static
{
contextClassLoader
=
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
ClassLoader
>()
{
public
ClassLoader
run
()
{
return
Thread
.
currentThread
().
getContextClassLoader
();
}
});
};
/**
* Sole constructor. (For invocation by subclass constructors, typically
* implicit.)
...
...
@@ -213,8 +210,8 @@ public abstract class Policy {
if
(
policy
==
null
)
{
String
policy_class
=
null
;
policy_class
=
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
String
>()
{
policy_class
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
String
>()
{
public
String
run
()
{
return
java
.
security
.
Security
.
getProperty
(
"auth.policy.provider"
);
...
...
@@ -226,18 +223,28 @@ public abstract class Policy {
try
{
final
String
finalClass
=
policy_class
;
policy
=
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedExceptionAction
<
Policy
>()
{
public
Policy
run
()
throws
ClassNotFoundException
,
InstantiationException
,
IllegalAccessException
{
return
(
Policy
)
Class
.
forName
(
finalClass
,
true
,
contextClassLoader
).
newInstance
();
}
});
isCustomPolicy
=
!
finalClass
.
equals
(
AUTH_POLICY
);
Policy
untrustedImpl
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
Policy
>()
{
public
Policy
run
()
throws
ClassNotFoundException
,
InstantiationException
,
IllegalAccessException
{
Class
<?
extends
Policy
>
implClass
=
Class
.
forName
(
finalClass
,
false
,
Thread
.
currentThread
().
getContextClassLoader
()
).
asSubclass
(
Policy
.
class
);
return
implClass
.
newInstance
();
}
});
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
Void
>()
{
public
Void
run
()
{
setPolicy
(
untrustedImpl
);
isCustomPolicy
=
!
finalClass
.
equals
(
AUTH_POLICY
);
return
null
;
}
},
Objects
.
requireNonNull
(
untrustedImpl
.
acc
)
);
}
catch
(
Exception
e
)
{
throw
new
SecurityException
(
sun
.
security
.
util
.
ResourcesMgr
.
getString
...
...
src/share/classes/javax/security/auth/login/Configuration.java
浏览文件 @
28e4321a
...
...
@@ -27,9 +27,6 @@ package javax.security.auth.login;
import
javax.security.auth.AuthPermission
;
import
java.io.*
;
import
java.util.*
;
import
java.net.URI
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.security.PrivilegedExceptionAction
;
...
...
@@ -38,7 +35,7 @@ import java.security.NoSuchAlgorithmException;
import
java.security.NoSuchProviderException
;
import
java.security.Provider
;
import
java.security.Security
;
import
java.
security.SecurityPermission
;
import
java.
util.Objects
;
import
sun.security.jca.GetInstance
;
...
...
@@ -191,16 +188,9 @@ import sun.security.jca.GetInstance;
public
abstract
class
Configuration
{
private
static
Configuration
configuration
;
private
static
ClassLoader
contextClassLoader
;
static
{
contextClassLoader
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
ClassLoader
>()
{
public
ClassLoader
run
()
{
return
Thread
.
currentThread
().
getContextClassLoader
();
}
});
};
private
final
java
.
security
.
AccessControlContext
acc
=
java
.
security
.
AccessController
.
getContext
();
private
static
void
checkPermission
(
String
type
)
{
SecurityManager
sm
=
System
.
getSecurityManager
();
...
...
@@ -253,17 +243,26 @@ public abstract class Configuration {
try
{
final
String
finalClass
=
config_class
;
configuration
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
Configuration
>()
{
public
Configuration
run
()
throws
ClassNotFoundException
,
InstantiationException
,
IllegalAccessException
{
return
(
Configuration
)
Class
.
forName
(
finalClass
,
true
,
contextClassLoader
).
newInstance
();
}
});
Configuration
untrustedImpl
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
Configuration
>()
{
public
Configuration
run
()
throws
ClassNotFoundException
,
InstantiationException
,
IllegalAccessException
{
Class
<?
extends
Configuration
>
implClass
=
Class
.
forName
(
finalClass
,
false
,
Thread
.
currentThread
().
getContextClassLoader
()
).
asSubclass
(
Configuration
.
class
);
return
implClass
.
newInstance
();
}
});
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
Void
>()
{
public
Void
run
()
{
setConfiguration
(
untrustedImpl
);
return
null
;
}
},
Objects
.
requireNonNull
(
untrustedImpl
.
acc
)
);
}
catch
(
PrivilegedActionException
e
)
{
Exception
ee
=
e
.
getException
();
if
(
ee
instanceof
InstantiationException
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录