Package java.security

Examples of java.security.CodeSource


   * @tests java.security.SecureClassLoader#getPermissions(java.security.CodeSource)
   */
  public void test_getPermissionsLjava_security_CodeSource() throws IOException {
    class MyClassLoader extends SecureClassLoader {
      public PermissionCollection getPerms() {
        return super.getPermissions(new CodeSource(null,
            (Certificate[]) null));
      }
View Full Code Here


            }

            if (entry.loadedClass == null) {
                clazz = defineClass(name, entry.binaryContent, 0,
                        entry.binaryContent.length,
                        new CodeSource(entry.codeBase, entry.certificates));
                entry.loadedClass = clazz;
                entry.binaryContent = null;
                entry.source = null;
                entry.codeBase = null;
                entry.manifest = null;
View Full Code Here

            }

        }

        // Create the code source object
        CodeSource codeSource =
            new CodeSource(entry.codeBase, entry.certificates);

        if (securityManager != null) {

            // Checking sealing
            if (pkg != null) {
View Full Code Here

*/
public class JACCPermissions {

  public static void checkPermission(Class clazz, String contextID, EJBMethodPermission methodPerm)
      throws SecurityException {
    CodeSource ejbCS = clazz.getProtectionDomain().getCodeSource();

    try {
      setContextID( contextID );

      Policy policy = Policy.getPolicy();
View Full Code Here

  private static String getSysPathFromCodeSource() {
    ProtectionDomain pd = EclipseStarter.class.getProtectionDomain();
    if (pd == null)
      return null;
    CodeSource cs = pd.getCodeSource();
    if (cs == null)
      return null;
    URL url = cs.getLocation();
    if (url == null)
      return null;
    String result = url.getFile();
    if (result.endsWith(".jar")) { //$NON-NLS-1$
      result = result.substring(0, result.lastIndexOf('/'));
View Full Code Here

            // Create the package if necessary
            URL codeSourceURL = null;
            if (protectionDomain != null)
            {
               CodeSource codeSource = protectionDomain.getCodeSource();
               if (codeSource != null)
                  codeSourceURL = codeSource.getLocation();
            }
            definePackage(name, codeSourceURL);

            // Finally we can define the class
            Class<?> result;
View Full Code Here

    * @return the deployer's location
    */
   protected String getDeployerLocation()
   {
      ProtectionDomain pd = getClass().getProtectionDomain();
      CodeSource cs = pd.getCodeSource();
      URL location = cs.getLocation();
      return location.toExternalForm();
   }
View Full Code Here

  }

  public static void initializeProperties() {
    // initialize some framework properties that must always be set
    if (getProperty(PROP_FRAMEWORK) == null || getProperty(PROP_INSTALL_AREA) == null) {
      CodeSource cs = FrameworkProperties.class.getProtectionDomain().getCodeSource();
      if (cs == null)
        throw new IllegalArgumentException(NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_PROPS_NOT_SET, PROP_FRAMEWORK + ", " + PROP_INSTALL_AREA)); //$NON-NLS-1$
      URL url = cs.getLocation();
      // allow props to be preset
      if (getProperty(PROP_FRAMEWORK) == null)
        setProperty(PROP_FRAMEWORK, url.toExternalForm());
      if (getProperty(PROP_INSTALL_AREA) == null) {
        String filePart = url.getFile();
View Full Code Here

  private void doPermissionCheckInContext(PermissionCheckEntityInformation entityInformation, PermissibleAction action) {
    final Policy policy = Policy.getPolicy();
    final Principal[] principals = getCallerPrincipals();

    final CodeSource codeSource = entityInformation.getEntity().getClass().getProtectionDomain().getCodeSource();
    final ProtectionDomain pd = new ProtectionDomain( codeSource, null, null, principals );

    // the action is known as 'method name' in JACC
    final EJBMethodPermission jaccPermission = new EJBMethodPermission(
        entityInformation.getEntityName(),
View Full Code Here

  else
      location = null;

  if (ge.principals == null || ge.principals.size() == 0) {
      return (canonicalizeCodebase
      (new CodeSource(location, certs),
      false));
  } else {
      return (canonicalizeCodebase
    (new SubjectCodeSource(null, ge.principals, location, certs),
    false));
View Full Code Here

TOP

Related Classes of java.security.CodeSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.