sun.security.util.ResourcesMgr Java Examples
The following examples show how to use
sun.security.util.ResourcesMgr.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PolicyFile.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public String toString(){ StringBuilder sb = new StringBuilder(); sb.append(ResourcesMgr.getString("LPARAM")); sb.append(getCodeSource()); sb.append("\n"); for (int j = 0; j < permissions.size(); j++) { Permission p = permissions.get(j); sb.append(ResourcesMgr.getString("SPACE")); sb.append(ResourcesMgr.getString("SPACE")); sb.append(p); sb.append(ResourcesMgr.getString("NEWLINE")); } sb.append(ResourcesMgr.getString("RPARAM")); sb.append(ResourcesMgr.getString("NEWLINE")); return sb.toString(); }
Example #2
Source File: ConfigFile.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private void init(URL config, Map<String, List<AppConfigurationEntry>> newConfig) throws IOException { try (InputStreamReader isr = new InputStreamReader(getInputStream(config), "UTF-8")) { readConfig(isr, newConfig); } catch (FileNotFoundException fnfe) { if (debugConfig != null) { debugConfig.println(fnfe.toString()); } throw new IOException(ResourcesMgr.getString ("Configuration.Error.No.such.file.or.directory", "sun.security.util.AuthResources")); } }
Example #3
Source File: ConfigFile.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private void init(URL config, Map<String, List<AppConfigurationEntry>> newConfig) throws IOException { try (InputStreamReader isr = new InputStreamReader(getInputStream(config), "UTF-8")) { readConfig(isr, newConfig); } catch (FileNotFoundException fnfe) { if (debugConfig != null) { debugConfig.println(fnfe.toString()); } throw new IOException(ResourcesMgr.getString ("Configuration.Error.No.such.file.or.directory", "sun.security.util.AuthResources")); } }
Example #4
Source File: PolicyParser.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * skip all tokens for this entry leaving the delimiter ";" * in the stream. */ private void skipEntry() throws ParsingException, IOException { while(lookahead != ';') { switch (lookahead) { case StreamTokenizer.TT_NUMBER: throw new ParsingException(st.lineno(), ";", ResourcesMgr.getString("number.") + String.valueOf(st.nval)); case StreamTokenizer.TT_EOF: throw new ParsingException(ResourcesMgr.getString ("expected.read.end.of.file.")); default: lookahead = st.nextToken(); } } }
Example #5
Source File: Subject.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public boolean remove(Object o) { Objects.requireNonNull(o, ResourcesMgr.getString("invalid.null.input.s.")); final Iterator<E> e = iterator(); while (e.hasNext()) { E next; if (which != Subject.PRIV_CREDENTIAL_SET) { next = e.next(); } else { next = java.security.AccessController.doPrivileged (new java.security.PrivilegedAction<E>() { public E run() { return e.next(); } }); } if (next.equals(o)) { e.remove(); return true; } } return false; }
Example #6
Source File: PolicyParser.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * skip all tokens for this entry leaving the delimiter ";" * in the stream. */ private void skipEntry() throws ParsingException, IOException { while(lookahead != ';') { switch (lookahead) { case StreamTokenizer.TT_NUMBER: throw new ParsingException(st.lineno(), ";", ResourcesMgr.getString("number.") + String.valueOf(st.nval)); case StreamTokenizer.TT_EOF: throw new ParsingException(ResourcesMgr.getString ("expected.read.end.of.file.")); default: lookahead = st.nextToken(); } } }
Example #7
Source File: PolicyFile.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public String toString(){ StringBuilder sb = new StringBuilder(); sb.append(ResourcesMgr.getString("LPARAM")); sb.append(getCodeSource()); sb.append("\n"); for (int j = 0; j < permissions.size(); j++) { Permission p = permissions.get(j); sb.append(ResourcesMgr.getString("SPACE")); sb.append(ResourcesMgr.getString("SPACE")); sb.append(p); sb.append(ResourcesMgr.getString("NEWLINE")); } sb.append(ResourcesMgr.getString("RPARAM")); sb.append(ResourcesMgr.getString("NEWLINE")); return sb.toString(); }
Example #8
Source File: Subject.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public boolean add(E o) { if (subject.isReadOnly()) { throw new IllegalStateException (ResourcesMgr.getString("Subject.is.read.only")); } java.lang.SecurityManager sm = System.getSecurityManager(); if (sm != null) { switch (which) { case Subject.PRINCIPAL_SET: sm.checkPermission(AuthPermissionHolder.MODIFY_PRINCIPALS_PERMISSION); break; case Subject.PUB_CREDENTIAL_SET: sm.checkPermission(AuthPermissionHolder.MODIFY_PUBLIC_CREDENTIALS_PERMISSION); break; default: sm.checkPermission(AuthPermissionHolder.MODIFY_PRIVATE_CREDENTIALS_PERMISSION); break; } } switch (which) { case Subject.PRINCIPAL_SET: if (!(o instanceof Principal)) { throw new SecurityException(ResourcesMgr.getString ("attempting.to.add.an.object.which.is.not.an.instance.of.java.security.Principal.to.a.Subject.s.Principal.Set")); } break; default: // ok to add Objects of any kind to credential sets break; } // check for duplicates if (!elements.contains(o)) return elements.add(o); else return false; }
Example #9
Source File: Subject.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public boolean contains(Object o) { Objects.requireNonNull(o, ResourcesMgr.getString("invalid.null.input.s.")); final Iterator<E> e = iterator(); while (e.hasNext()) { E next; if (which != Subject.PRIV_CREDENTIAL_SET) { next = e.next(); } else { // For private credentials: // If the caller does not have read permission for // for o.getClass(), we throw a SecurityException. // Otherwise we check the private cred set to see whether // it contains the Object SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new PrivateCredentialPermission (o.getClass().getName(), subject.getPrincipals())); } next = java.security.AccessController.doPrivileged (new java.security.PrivilegedAction<E>() { public E run() { return e.next(); } }); } if (next.equals(o)) { return true; } } return false; }
Example #10
Source File: Subject.java From j2objc with Apache License 2.0 | 5 votes |
/** * Reads this object from a stream (i.e., deserializes it) */ @SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { ObjectInputStream.GetField gf = s.readFields(); readOnly = gf.get("readOnly", false); Set<Principal> inputPrincs = (Set<Principal>)gf.get("principals", null); // Rewrap the principals into a SecureSet if (inputPrincs == null) { throw new NullPointerException (ResourcesMgr.getString("invalid.null.input.s.")); } try { principals = Collections.synchronizedSet(new SecureSet<Principal> (this, PRINCIPAL_SET, inputPrincs)); } catch (NullPointerException npe) { // Sometimes people deserialize the principals set only. // Subject is not accessible, so just don't fail. principals = Collections.synchronizedSet (new SecureSet<Principal>(this, PRINCIPAL_SET)); } // The Credential {@code Set} is not serialized, but we do not // want the default deserialization routine to set it to null. this.pubCredentials = Collections.synchronizedSet (new SecureSet<Object>(this, PUB_CREDENTIAL_SET)); this.privCredentials = Collections.synchronizedSet (new SecureSet<Object>(this, PRIV_CREDENTIAL_SET)); }
Example #11
Source File: Subject.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Reads this object from a stream (i.e., deserializes it) */ @SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { ObjectInputStream.GetField gf = s.readFields(); readOnly = gf.get("readOnly", false); Set<Principal> inputPrincs = (Set<Principal>)gf.get("principals", null); Objects.requireNonNull(inputPrincs, ResourcesMgr.getString("invalid.null.input.s.")); // Rewrap the principals into a SecureSet try { principals = Collections.synchronizedSet(new SecureSet<> (this, PRINCIPAL_SET, inputPrincs)); } catch (NullPointerException npe) { // Sometimes people deserialize the principals set only. // Subject is not accessible, so just don't fail. principals = Collections.synchronizedSet (new SecureSet<>(this, PRINCIPAL_SET)); } // The Credential {@code Set} is not serialized, but we do not // want the default deserialization routine to set it to null. this.pubCredentials = Collections.synchronizedSet (new SecureSet<>(this, PUB_CREDENTIAL_SET)); this.privCredentials = Collections.synchronizedSet (new SecureSet<>(this, PRIV_CREDENTIAL_SET)); }
Example #12
Source File: Subject.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public boolean add(T o) { if (!o.getClass().isAssignableFrom(c)) { MessageFormat form = new MessageFormat(ResourcesMgr.getString ("attempting.to.add.an.object.which.is.not.an.instance.of.class")); Object[] source = {c.toString()}; throw new SecurityException(form.format(source)); } return set.add(o); }
Example #13
Source File: Subject.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public boolean add(T o) { if (!o.getClass().isAssignableFrom(c)) { MessageFormat form = new MessageFormat(ResourcesMgr.getString ("attempting.to.add.an.object.which.is.not.an.instance.of.class")); Object[] source = {c.toString()}; throw new SecurityException(form.format(source)); } return set.add(o); }
Example #14
Source File: Subject.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public boolean add(T o) { if (!o.getClass().isAssignableFrom(c)) { MessageFormat form = new MessageFormat(ResourcesMgr.getString ("attempting.to.add.an.object.which.is.not.an.instance.of.class")); Object[] source = {c.toString()}; throw new SecurityException(form.format(source)); } return set.add(o); }
Example #15
Source File: PolicyParser.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
void add(KeyStoreEntry entry) throws ParsingException { String keystoreName = entry.getName(); if (!entries.containsKey(keystoreName)) { entries.put(keystoreName, entry); } else { MessageFormat form = new MessageFormat(ResourcesMgr.getString( "duplicate.keystore.name")); Object[] source = {keystoreName}; throw new ParsingException(form.format(source)); } }
Example #16
Source File: Subject.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Reads this object from a stream (i.e., deserializes it) */ @SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { ObjectInputStream.GetField gf = s.readFields(); readOnly = gf.get("readOnly", false); Set<Principal> inputPrincs = (Set<Principal>)gf.get("principals", null); // Rewrap the principals into a SecureSet if (inputPrincs == null) { throw new NullPointerException (ResourcesMgr.getString("invalid.null.input.s.")); } try { principals = Collections.synchronizedSet(new SecureSet<Principal> (this, PRINCIPAL_SET, inputPrincs)); } catch (NullPointerException npe) { // Sometimes people deserialize the principals set only. // Subject is not accessible, so just don't fail. principals = Collections.synchronizedSet (new SecureSet<Principal>(this, PRINCIPAL_SET)); } // The Credential {@code Set} is not serialized, but we do not // want the default deserialization routine to set it to null. this.pubCredentials = Collections.synchronizedSet (new SecureSet<Object>(this, PUB_CREDENTIAL_SET)); this.privCredentials = Collections.synchronizedSet (new SecureSet<Object>(this, PRIV_CREDENTIAL_SET)); }
Example #17
Source File: Subject.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public boolean add(T o) { if (!o.getClass().isAssignableFrom(c)) { MessageFormat form = new MessageFormat(ResourcesMgr.getString ("attempting.to.add.an.object.which.is.not.an.instance.of.class")); Object[] source = {c.toString()}; throw new SecurityException(form.format(source)); } return set.add(o); }
Example #18
Source File: PolicyParser.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public ParsingException(int line, String msg) { super("line " + line + ": " + msg); MessageFormat form = new MessageFormat (ResourcesMgr.getString("line.number.msg")); Object[] source = {new Integer(line), msg}; i18nMessage = form.format(source); }
Example #19
Source File: Subject.java From Bytecoder with Apache License 2.0 | 5 votes |
@Override public boolean add(T o) { if (!c.isAssignableFrom(o.getClass())) { MessageFormat form = new MessageFormat(ResourcesMgr.getString ("attempting.to.add.an.object.which.is.not.an.instance.of.class")); Object[] source = {c.toString()}; throw new SecurityException(form.format(source)); } return set.add(o); }
Example #20
Source File: Subject.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Reads this object from a stream (i.e., deserializes it) */ @SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { ObjectInputStream.GetField gf = s.readFields(); readOnly = gf.get("readOnly", false); Set<Principal> inputPrincs = (Set<Principal>)gf.get("principals", null); // Rewrap the principals into a SecureSet if (inputPrincs == null) { throw new NullPointerException (ResourcesMgr.getString("invalid.null.input.s.")); } try { principals = Collections.synchronizedSet(new SecureSet<Principal> (this, PRINCIPAL_SET, inputPrincs)); } catch (NullPointerException npe) { // Sometimes people deserialize the principals set only. // Subject is not accessible, so just don't fail. principals = Collections.synchronizedSet (new SecureSet<Principal>(this, PRINCIPAL_SET)); } // The Credential {@code Set} is not serialized, but we do not // want the default deserialization routine to set it to null. this.pubCredentials = Collections.synchronizedSet (new SecureSet<Object>(this, PUB_CREDENTIAL_SET)); this.privCredentials = Collections.synchronizedSet (new SecureSet<Object>(this, PRIV_CREDENTIAL_SET)); }
Example #21
Source File: PolicyParser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * parses a keystore entry */ private void parseKeyStoreEntry() throws ParsingException, IOException { match("keystore"); keyStoreUrlString = match("quoted string"); // parse keystore type if (!peek(",")) { return; // default type } match(","); if (peek("\"")) { keyStoreType = match("quoted string"); } else { throw new ParsingException(st.lineno(), ResourcesMgr.getString("expected.keystore.type")); } // parse keystore provider if (!peek(",")) { return; // provider optional } match(","); if (peek("\"")) { keyStoreProvider = match("quoted string"); } else { throw new ParsingException(st.lineno(), ResourcesMgr.getString("expected.keystore.provider")); } }
Example #22
Source File: Subject.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public boolean add(T o) { if (!o.getClass().isAssignableFrom(c)) { MessageFormat form = new MessageFormat(ResourcesMgr.getString ("attempting.to.add.an.object.which.is.not.an.instance.of.class")); Object[] source = {c.toString()}; throw new SecurityException(form.format(source)); } return set.add(o); }
Example #23
Source File: Subject.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Reads this object from a stream (i.e., deserializes it) */ @SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { ObjectInputStream.GetField gf = s.readFields(); readOnly = gf.get("readOnly", false); Set<Principal> inputPrincs = (Set<Principal>)gf.get("principals", null); // Rewrap the principals into a SecureSet if (inputPrincs == null) { throw new NullPointerException (ResourcesMgr.getString("invalid.null.input.s.")); } try { principals = Collections.synchronizedSet(new SecureSet<Principal> (this, PRINCIPAL_SET, inputPrincs)); } catch (NullPointerException npe) { // Sometimes people deserialize the principals set only. // Subject is not accessible, so just don't fail. principals = Collections.synchronizedSet (new SecureSet<Principal>(this, PRINCIPAL_SET)); } // The Credential {@code Set} is not serialized, but we do not // want the default deserialization routine to set it to null. this.pubCredentials = Collections.synchronizedSet (new SecureSet<Object>(this, PUB_CREDENTIAL_SET)); this.privCredentials = Collections.synchronizedSet (new SecureSet<Object>(this, PRIV_CREDENTIAL_SET)); }
Example #24
Source File: Subject.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public boolean add(E o) { if (subject.isReadOnly()) { throw new IllegalStateException (ResourcesMgr.getString("Subject.is.read.only")); } java.lang.SecurityManager sm = System.getSecurityManager(); if (sm != null) { switch (which) { case Subject.PRINCIPAL_SET: sm.checkPermission(AuthPermissionHolder.MODIFY_PRINCIPALS_PERMISSION); break; case Subject.PUB_CREDENTIAL_SET: sm.checkPermission(AuthPermissionHolder.MODIFY_PUBLIC_CREDENTIALS_PERMISSION); break; default: sm.checkPermission(AuthPermissionHolder.MODIFY_PRIVATE_CREDENTIALS_PERMISSION); break; } } switch (which) { case Subject.PRINCIPAL_SET: if (!(o instanceof Principal)) { throw new SecurityException(ResourcesMgr.getString ("attempting.to.add.an.object.which.is.not.an.instance.of.java.security.Principal.to.a.Subject.s.Principal.Set")); } break; default: // ok to add Objects of any kind to credential sets break; } // check for duplicates if (!elements.contains(o)) return elements.add(o); else return false; }
Example #25
Source File: Subject.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public boolean add(T o) { if (!o.getClass().isAssignableFrom(c)) { MessageFormat form = new MessageFormat(ResourcesMgr.getString ("attempting.to.add.an.object.which.is.not.an.instance.of.class")); Object[] source = {c.toString()}; throw new SecurityException(form.format(source)); } return set.add(o); }
Example #26
Source File: Subject.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Reads this object from a stream (i.e., deserializes it) */ @SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { ObjectInputStream.GetField gf = s.readFields(); readOnly = gf.get("readOnly", false); Set<Principal> inputPrincs = (Set<Principal>)gf.get("principals", null); // Rewrap the principals into a SecureSet if (inputPrincs == null) { throw new NullPointerException (ResourcesMgr.getString("invalid.null.input.s.")); } try { principals = Collections.synchronizedSet(new SecureSet<Principal> (this, PRINCIPAL_SET, inputPrincs)); } catch (NullPointerException npe) { // Sometimes people deserialize the principals set only. // Subject is not accessible, so just don't fail. principals = Collections.synchronizedSet (new SecureSet<Principal>(this, PRINCIPAL_SET)); } // The Credential {@code Set} is not serialized, but we do not // want the default deserialization routine to set it to null. this.pubCredentials = Collections.synchronizedSet (new SecureSet<Object>(this, PUB_CREDENTIAL_SET)); this.privCredentials = Collections.synchronizedSet (new SecureSet<Object>(this, PRIV_CREDENTIAL_SET)); }
Example #27
Source File: PolicyParser.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public ParsingException(int line, String expect, String actual) { super("line " + line + ": expected [" + expect + "], found [" + actual + "]"); MessageFormat form = new MessageFormat(ResourcesMgr.getString ("line.number.expected.expect.found.actual.")); Object[] source = {new Integer(line), expect, actual}; i18nMessage = form.format(source); }
Example #28
Source File: PolicyParser.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * parses a keystore entry */ private void parseKeyStoreEntry() throws ParsingException, IOException { match("keystore"); keyStoreUrlString = match("quoted string"); // parse keystore type if (!peek(",")) { return; // default type } match(","); if (peek("\"")) { keyStoreType = match("quoted string"); } else { throw new ParsingException(st.lineno(), ResourcesMgr.getString("expected.keystore.type")); } // parse keystore provider if (!peek(",")) { return; // provider optional } match(","); if (peek("\"")) { keyStoreProvider = match("quoted string"); } else { throw new ParsingException(st.lineno(), ResourcesMgr.getString("expected.keystore.provider")); } }
Example #29
Source File: PolicyParser.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public ParsingException(int line, String msg) { super("line " + line + ": " + msg); MessageFormat form = new MessageFormat (ResourcesMgr.getString("line.number.msg")); Object[] source = {new Integer(line), msg}; i18nMessage = form.format(source); }
Example #30
Source File: PolicyParser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private String match(String expect) throws ParsingException, IOException { String value = null; switch (lookahead) { case StreamTokenizer.TT_NUMBER: throw new ParsingException(st.lineno(), expect, ResourcesMgr.getString("number.") + String.valueOf(st.nval)); case StreamTokenizer.TT_EOF: MessageFormat form = new MessageFormat( ResourcesMgr.getString ("expected.expect.read.end.of.file.")); Object[] source = {expect}; throw new ParsingException(form.format(source)); case StreamTokenizer.TT_WORD: if (expect.equalsIgnoreCase(st.sval)) { lookahead = st.nextToken(); } else if (expect.equalsIgnoreCase("permission type")) { value = st.sval; lookahead = st.nextToken(); } else if (expect.equalsIgnoreCase("principal type")) { value = st.sval; lookahead = st.nextToken(); } else if (expect.equalsIgnoreCase("domain name") || expect.equalsIgnoreCase("keystore name") || expect.equalsIgnoreCase("property name")) { value = st.sval; lookahead = st.nextToken(); } else { throw new ParsingException(st.lineno(), expect, st.sval); } break; case '"': if (expect.equalsIgnoreCase("quoted string")) { value = st.sval; lookahead = st.nextToken(); } else if (expect.equalsIgnoreCase("permission type")) { value = st.sval; lookahead = st.nextToken(); } else if (expect.equalsIgnoreCase("principal type")) { value = st.sval; lookahead = st.nextToken(); } else { throw new ParsingException(st.lineno(), expect, st.sval); } break; case ',': if (expect.equalsIgnoreCase(",")) lookahead = st.nextToken(); else throw new ParsingException(st.lineno(), expect, ","); break; case '{': if (expect.equalsIgnoreCase("{")) lookahead = st.nextToken(); else throw new ParsingException(st.lineno(), expect, "{"); break; case '}': if (expect.equalsIgnoreCase("}")) lookahead = st.nextToken(); else throw new ParsingException(st.lineno(), expect, "}"); break; case ';': if (expect.equalsIgnoreCase(";")) lookahead = st.nextToken(); else throw new ParsingException(st.lineno(), expect, ";"); break; case '*': if (expect.equalsIgnoreCase("*")) lookahead = st.nextToken(); else throw new ParsingException(st.lineno(), expect, "*"); break; case '=': if (expect.equalsIgnoreCase("=")) lookahead = st.nextToken(); else throw new ParsingException(st.lineno(), expect, "="); break; default: throw new ParsingException(st.lineno(), expect, new String(new char[] {(char)lookahead})); } return value; }