pli =
+ scs.getPrincipals().listIterator();
while (pli.hasNext()) {
- PolicyParser.PrincipalEntry principal = pli.next();
+ PrincipalEntry principal = pli.next();
// XXX
// if the Policy entry's Principal does not contain a
@@ -1050,30 +1052,29 @@ public class PolicyFile extends javax.security.auth.Policy {
* if (y == 1), it's the principal name.
*/
private String[][] getPrincipalInfo
- (PolicyParser.PrincipalEntry principal,
- final CodeSource accCs) {
+ (PrincipalEntry principal, final CodeSource accCs) {
// there are 3 possibilities:
// 1) the entry's Principal class and name are not wildcarded
// 2) the entry's Principal name is wildcarded only
// 3) the entry's Principal class and name are wildcarded
- if (!principal.principalClass.equals
- (PolicyParser.PrincipalEntry.WILDCARD_CLASS) &&
- !principal.principalName.equals
- (PolicyParser.PrincipalEntry.WILDCARD_NAME)) {
+ if (!principal.getPrincipalClass().equals
+ (PrincipalEntry.WILDCARD_CLASS) &&
+ !principal.getPrincipalName().equals
+ (PrincipalEntry.WILDCARD_NAME)) {
// build a PrivateCredentialPermission for the principal
// from the Policy entry
String[][] info = new String[1][2];
- info[0][0] = principal.principalClass;
- info[0][1] = principal.principalName;
+ info[0][0] = principal.getPrincipalClass();
+ info[0][1] = principal.getPrincipalName();
return info;
- } else if (!principal.principalClass.equals
- (PolicyParser.PrincipalEntry.WILDCARD_CLASS) &&
- principal.principalName.equals
- (PolicyParser.PrincipalEntry.WILDCARD_NAME)) {
+ } else if (!principal.getPrincipalClass().equals
+ (PrincipalEntry.WILDCARD_CLASS) &&
+ principal.getPrincipalName().equals
+ (PrincipalEntry.WILDCARD_NAME)) {
// build a PrivateCredentialPermission for all
// the Subject's principals that are instances of principalClass
@@ -1088,7 +1089,7 @@ public class PolicyFile extends javax.security.auth.Policy {
// If it doesn't, we should stop here with a ClassCastException.
@SuppressWarnings("unchecked")
Class extends Principal> pClass = (Class extends Principal>)
- Class.forName(principal.principalClass, false,
+ Class.forName(principal.getPrincipalClass(), false,
ClassLoader.getSystemClassLoader());
principalSet = scs.getSubject().getPrincipals(pClass);
} catch (Exception e) {
@@ -1387,6 +1388,7 @@ public class PolicyFile extends javax.security.auth.Policy {
}
}
+@SuppressWarnings("deprecation")
class PolicyPermissions extends PermissionCollection {
private static final long serialVersionUID = -1954188373270545523L;
diff --git a/jdk/src/share/classes/com/sun/security/auth/SubjectCodeSource.java b/jdk/src/share/classes/com/sun/security/auth/SubjectCodeSource.java
index 35d3bf1c410..7e38a087420 100644
--- a/jdk/src/share/classes/com/sun/security/auth/SubjectCodeSource.java
+++ b/jdk/src/share/classes/com/sun/security/auth/SubjectCodeSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@ import java.security.cert.Certificate;
import java.lang.reflect.Constructor;
import javax.security.auth.Subject;
+import sun.security.provider.PolicyParser.PrincipalEntry;
/**
* This SubjectCodeSource
class contains
@@ -57,7 +58,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
});
private Subject subject;
- private LinkedList principals;
+ private LinkedList principals;
private static final Class[] PARAMS = { String.class };
private static final sun.security.util.Debug debug =
sun.security.util.Debug.getInstance("auth", "\t[Auth Access]");
@@ -87,14 +88,14 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
* SubjectCodeSource
*/
SubjectCodeSource(Subject subject,
- LinkedList principals,
+ LinkedList principals,
URL url, Certificate[] certs) {
super(url, certs);
this.subject = subject;
this.principals = (principals == null ?
- new LinkedList() :
- new LinkedList(principals));
+ new LinkedList() :
+ new LinkedList(principals));
sysClassLoader = java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction() {
public ClassLoader run() {
@@ -114,7 +115,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
* SubjectCodeSource
as a LinkedList
* of PolicyParser.PrincipalEntry
objects.
*/
- LinkedList getPrincipals() {
+ LinkedList getPrincipals() {
return principals;
}
@@ -167,7 +168,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
*/
public boolean implies(CodeSource codesource) {
- LinkedList subjectList = null;
+ LinkedList subjectList = null;
if (codesource == null ||
!(codesource instanceof SubjectCodeSource) ||
@@ -197,20 +198,19 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
return false;
}
- ListIterator li =
- this.principals.listIterator(0);
+ ListIterator li = this.principals.listIterator(0);
while (li.hasNext()) {
- PolicyParser.PrincipalEntry pppe = li.next();
+ PrincipalEntry pppe = li.next();
try {
// handle PrincipalComparators
Class> principalComparator = Class.forName(
- pppe.principalClass, true, sysClassLoader);
+ pppe.getPrincipalClass(), true, sysClassLoader);
Constructor> c = principalComparator.getConstructor(PARAMS);
PrincipalComparator pc =
(PrincipalComparator)c.newInstance
- (new Object[] { pppe.principalName });
+ (new Object[] { pppe.getPrincipalName() });
if (!pc.implies(that.getSubject())) {
if (debug != null)
@@ -236,11 +236,10 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
Iterator i =
that.getSubject().getPrincipals().iterator();
- subjectList = new LinkedList();
+ subjectList = new LinkedList();
while (i.hasNext()) {
Principal p = i.next();
- PolicyParser.PrincipalEntry spppe =
- new PolicyParser.PrincipalEntry
+ PrincipalEntry spppe = new PrincipalEntry
(p.getClass().getName(), p.getName());
subjectList.add(spppe);
}
@@ -281,23 +280,19 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
* pppe argument.
*/
private boolean subjectListImpliesPrincipalEntry(
- LinkedList subjectList,
- PolicyParser.PrincipalEntry pppe) {
+ LinkedList subjectList, PrincipalEntry pppe) {
- ListIterator li =
- subjectList.listIterator(0);
+ ListIterator li = subjectList.listIterator(0);
while (li.hasNext()) {
- PolicyParser.PrincipalEntry listPppe = li.next();
+ PrincipalEntry listPppe = li.next();
- if (pppe.principalClass.equals
- (PolicyParser.PrincipalEntry.WILDCARD_CLASS) ||
- pppe.principalClass.equals
- (listPppe.principalClass)) {
-
- if (pppe.principalName.equals
- (PolicyParser.PrincipalEntry.WILDCARD_NAME) ||
- pppe.principalName.equals
- (listPppe.principalName))
+ if (pppe.getPrincipalClass().equals
+ (PrincipalEntry.WILDCARD_CLASS) ||
+ pppe.getPrincipalClass().equals(listPppe.getPrincipalClass()))
+ {
+ if (pppe.getPrincipalName().equals
+ (PrincipalEntry.WILDCARD_NAME) ||
+ pppe.getPrincipalName().equals(listPppe.getPrincipalName()))
return true;
}
}
@@ -390,13 +385,12 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
}
}
if (principals != null) {
- ListIterator li =
- principals.listIterator();
+ ListIterator li = principals.listIterator();
while (li.hasNext()) {
- PolicyParser.PrincipalEntry pppe = li.next();
+ PrincipalEntry pppe = li.next();
returnMe = returnMe + rb.getString("NEWLINE") +
- pppe.principalClass + " " +
- pppe.principalName;
+ pppe.getPrincipalClass() + " " +
+ pppe.getPrincipalName();
}
}
return returnMe;