Requests permissions immediately, <b>must be invoked during initialization phase of your application</b>.
348
@Override @NonNull @CheckReturnValue public Observable<Permission> requestEach(@NonNull final String... permissions) {
    return Observable.just(TRIGGER)
        .compose(ensureEach(permissions));
  }
621586
@Override
    public void updatePermissions(IPermission[] permissions) throws AuthorizationException {
        if (permissions.length > 0) {
            getPermissionStore().update(permissions);
            if (this.cachePermissions) {
                removeFromPermissionsCache(permissions);
            }
        }
    }
162863
@Override
    public boolean requestPermissionToClose(long waitForPermission) {
        synchronized (this) {
            if ((currentState & CLOSE_NOT_ALLOWED_MASK) == 0) {

                if ((currentState & READ_OUTSTANDING) != 0) {
                    readOutWithClosePending = true;
                } else {
                    readOutWithClosePending = false;
                }
                if ((currentState & WRITE_OUTSTANDING) != 0) {
                    writeOutWithClosePending = true;
                } else {
                    writeOutWithClosePending = false;
                }

                currentState = CLOSE_PENDING;

                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "requestPermissionToClose returning true");
                }
                return true;
            }

            if (waitForPermission <= 0) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "requestPermissionToClose returning false");
                }
                return false;
            }

            long waitTillTime = (System.nanoTime() / ONE_MILLISECOND_IN_NANOSECONDS) + waitForPermission; //Measured in ms
            long waitTime = waitForPermission;
            while (true) {
                // wait for a state change that will allow closing
                try {
                    closeWaiting = true;
                    this.wait(waitTime);
                    closeWaiting = false;

                    // See if Permission can be granted
                    if ((currentState & CLOSE_NOT_ALLOWED_MASK) == 0) {

                        if ((currentState & READ_OUTSTANDING) != 0) {
                            readOutWithClosePending = true;
                        } else {
                            readOutWithClosePending = false;
                        }
                        if ((currentState & WRITE_OUTSTANDING) != 0) {
                            writeOutWithClosePending = true;
                        } else {
                            writeOutWithClosePending = false;
                        }
                        currentState = CLOSE_PENDING;

                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "requestPermissionToClose returning(2) true");
                        }
                        return true;
                    }
                    waitTime = (waitTillTime - (System.nanoTime() / ONE_MILLISECOND_IN_NANOSECONDS));
                    if (waitTime <= 0) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "requestPermissionToClose returning(2) false");
                        }
                        return false;
                    }
                    continue;
                } catch (InterruptedException x) {
                    // See if Permission can be granted
                    if ((currentState & CLOSE_NOT_ALLOWED_MASK) == 0) {

                        if ((currentState & READ_OUTSTANDING) != 0) {
                            readOutWithClosePending = true;
                        } else {
                            readOutWithClosePending = false;
                        }
                        if ((currentState & WRITE_OUTSTANDING) != 0) {
                            writeOutWithClosePending = true;
                        } else {
                            writeOutWithClosePending = false;
                        }
                        currentState = CLOSE_PENDING;

                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "requestPermissionToClose returning(3) true");
                        }
                        return true;
                    }
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "requestPermissionToClose returning(3) false");
                    }
                    return false;
                }
            } // end-while
        } // end-sync
    }
467229
public void requestAfterExplanation(@NonNull String permissionName) {
        if (isPermissionDeclined(permissionName)) {
            ActivityCompat.requestPermissions(context, new String[]{permissionName}, REQUEST_PERMISSIONS);
        } else {
            permissionCallback.onPermissionPreGranted(permissionName);
        }
    }
1240993
public static void getPermission(@NonNull Fragment context, String permissions, @NonNull Response response) {
        getPermission(context, new String[]{permissions}, response);
    }
1222238
@Override
	public boolean checkPermission(Permission permission)
	{
		if (permission == null)
			return false;

		boolean authorized = false;
		for (Permission accessPermission : permissions)
		{
			if(accessPermission.isAuthorized(permission))
			{
				authorized = true;
				break;
			}
		}
		
		if(negative)
			return !authorized;
		else
			return authorized;
	}
808897
private static void checkPermission(final Subject user, 
                                      final Permission... permissions) 
  throws AuthorizationException {
    try{
      Subject.doAs(user, 
                   new PrivilegedExceptionAction<Void>() {
                     @Override
                     public Void run() throws Exception {
                       try {
                         for(Permission permission : permissions) {
                           AccessController.checkPermission(permission);
                         }
                       } catch (AccessControlException ace) {
                         LOG.info("Authorization failed for " + 
                                  UserGroupInformation.getCurrentUGI(), ace);
                         throw new AuthorizationException(ace);
                       }
                      return null;
                     }
                   }
                  );
    } catch (PrivilegedActionException e) {
      throw new AuthorizationException(e.getException());
    }
  }
269746
@Override
    protected void handlePermission(@NonNull File path) {
//         Should we show an explanation?
//        if (shouldShowRequestPermissionRationale(
//                Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
//             Explain to the user why we need permission
//        }

        mRequestedPath = path;
        requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
                PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
    }
739286
public static void getPermission(@NonNull Activity context, @NonNull String[] permissions, @NonNull Response response) {
        if (Build.VERSION.SDK_INT < 23) {
            response.permissionGranted();
        } else {

            HashSet<String> permissionSet = new HashSet<>();

            for (String permission : permissions)
                if (ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
                    permissionSet.add(permission);
                }

            if (permissionSet.size() > 0) {
                int id = 42167;
                while (map.containsKey(id))
                    id = random.nextInt(Short.MAX_VALUE * 2);

                map.put(id, new ResponseWrapper(response, permissions));

                context.requestPermissions(permissionSet.toArray(new String[permissionSet.size()]), id);
            } else {
                response.permissionGranted();
            }
        }
    }
1304587
protected void requestPermission(final PermissionModel model) {
        new AlertDialog.Builder(this)
                .setTitle(model.getTitle())
                .setMessage(model.getExplanationMessage())
                .setPositiveButton("Request", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (model.getPermissionName().equalsIgnoreCase(Manifest.permission.SYSTEM_ALERT_WINDOW)) {
                            permissionHelper.requestSystemAlertPermission();
                        } else {
                            permissionHelper.requestAfterExplanation(model.getPermissionName());
                        }
                    }
                }).show();
    }
675503
@PostConstruct
    public synchronized void initialize() {
        final FwWebDirection direction = assistWebDirection();
        final DoubleSubmitResourceProvider provider = direction.assistDoubleSubmitResourceProvider();
        allowsVerifyTokenBeforeValidation = provider != null && provider.allowsVerifyTokenBeforeValidation();
        showBootLogging();
    }
424871
@Override
    public void refresh() {
		try {
            _roles.clear();

			List<Permission> permissions = new ArrayList<Permission>();
			String name = null;
			for (Permission auth: _authority.loadRolesAndPermissions()) {
				if (name != null && !name.equals(auth.roleId)) {
					_logger.fine(name + " with " + permissions.size() + " authorizations");
					_roles.put(name, permissions.toArray(new Permission[permissions.size()]));
					permissions.clear();
				}
				name = auth.roleId;
				permissions.add(auth);
			}
			if (name != null) {
				_logger.fine(name + " with " + permissions.size() + " authorizations");
				_roles.put(name, permissions.toArray(new Permission[permissions.size()]));
			}

			_logger.info("Completed loading all roles & permissions");
		} catch (Exception x) {
			throw new ServiceException("***FailureInLoadingRoles", x);
		}
    }
1289661
public synchronized void initialRequestDone() {
        initialRequestDone = true;
        if (previousAsyncContext != null) {
            previousAsyncContext.onAsyncStart(this);
            previousAsyncContext = null;
        }
        if (!processingAsyncTask) {
            processAsyncTask();
        }
        initiatingThread = null;
    }
464369
private void runSubmissions(boolean block) throws InterruptedException {
        if (block) {
            Runnable r = m_submissionQueue.take();
            do {
                r.run();
            } while ((r = m_submissionQueue.poll()) != null);
        } else {
            Runnable r = null;
            while ((r = m_submissionQueue.poll()) != null) {
                r.run();
            }
        }
    }
338526
public static void init(final AuthAPI authzAPI, AuthzFacade facade) throws Exception {
		/**
		 * get all Users who have Permission X
		 */
		authzAPI.route(GET,"/authz/users/perm/:type/:instance/:action",API.USERS,new Code(facade,"Get Users By Permission", true) {
			@Override
			public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
//				trans.checkpoint(pathParam(req,"type") + " " 
//						+ pathParam(req,"instance") + " " 
//						+ pathParam(req,"action"));
//
				Result<Void> r = context.getUsersByPermission(trans, resp,
						pathParam(req, ":type"),
						pathParam(req, ":instance"),
						pathParam(req, ":action"));
				switch(r.status) {
					case OK:
						resp.setStatus(HttpStatus.OK_200); 
						break;
					default:
						context.error(trans,resp,r);
				}
			}
		});


		/**
		 * get all Users who have Role X
		 */
		authzAPI.route(GET,"/authz/users/role/:role",API.USERS,new Code(facade,"Get Users By Role", true) {
			@Override
			public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
				Result<Void> r = context.getUsersByRole(trans, resp, pathParam(req, ":role"));
				switch(r.status) {
					case OK:
						resp.setStatus(HttpStatus.OK_200); 
						break;
					default:
						context.error(trans,resp,r);
				}
			}
		});
		
		/**
		 * Get User Role if exists
		 * @deprecated
		 */
		authzAPI.route(GET,"/authz/userRole/:user/:role",API.USERS,new Code(facade,"Get if User is In Role", true) {
			@Override
			public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
				Result<Void> r = context.getUserInRole(trans, resp, pathParam(req,":user"),pathParam(req,":role"));
				switch(r.status) {
					case OK:
						resp.setStatus(HttpStatus.OK_200); 
						break;
					default:
						context.error(trans,resp,r);
				}
			}
		});

		/**
		 * Get User Role if exists
		 */
		authzAPI.route(GET,"/authz/users/:user/:role",API.USERS,new Code(facade,"Get if User is In Role", true) {
			@Override
			public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
				Result<Void> r = context.getUserInRole(trans, resp, pathParam(req,":user"),pathParam(req,":role"));
				switch(r.status) {
					case OK:
						resp.setStatus(HttpStatus.OK_200); 
						break;
					default:
						context.error(trans,resp,r);
				}
			}
		});
		


	}
675124
@Override
    public java.util.concurrent.Future<AddPermissionResult> addPermissionAsync(String queueUrl, String label, java.util.List<String> aWSAccountIds,
            java.util.List<String> actions, com.amazonaws.handlers.AsyncHandler<AddPermissionRequest, AddPermissionResult> asyncHandler) {

        return addPermissionAsync(new AddPermissionRequest().withQueueUrl(queueUrl).withLabel(label).withAWSAccountIds(aWSAccountIds).withActions(actions),
                asyncHandler);
    }
1354328
private void initRequestHandler(ServletContext context, Properties configProps) throws ServletException {

		long initialTime = System.currentTimeMillis();
		if (LOGGER.isInfoEnabled())
			LOGGER.info("Initializing jawr config for request handler named " + getInitParameter("handlerName"));

		this.servletContext = context;
		this.overrideProperties = configProps;
		resourceType = getInitParameter("type");
		resourceType = null == resourceType ? "js" : resourceType;

		if (resourceType.equals("img")) {
			throw new BundlingProcessException(
					"The resource type 'img' is not supported since the version 3.6. You should use the type 'binary' instead.");
		}

		// Check if the resource type is a valid one
		if (!(resourceType.equals(JawrConstant.JS_TYPE) || resourceType.equals(JawrConstant.CSS_TYPE)
				|| resourceType.equals(JawrConstant.BINARY_TYPE))) {
			throw new BundlingProcessException("Unknown resource Type:" + resourceType);
		}

		// Initialize the config properties source that will provide with all
		// configuration options.
		ConfigPropertiesSource propsSrc = initConfigPropertiesSource(context, configProps);

		// Read properties from properties source
		Properties props = propsSrc.getConfigProperties();
		// override the properties if needed
		if (this.overrideProperties != null) {
			props.putAll(overrideProperties);
		}

		// hang onto the propertiesSource for manual reloads
		this.propertiesSource = propsSrc;

		// Initialize the ConfigPropertyResolver
		initConfigPropertyResolver(context);

		initializeJawrContext(props);

		// Initialize the properties reloading checker daemon if specified
		if (!ThreadLocalJawrContext.isBundleProcessingAtBuildTime()
				&& null != props.getProperty(CONFIG_RELOAD_INTERVAL)) {
			int interval = Integer.parseInt(props.getProperty(CONFIG_RELOAD_INTERVAL));
			LOGGER.warn("Jawr started with configuration auto reloading on. "
					+ "Be aware that a daemon thread will be checking for changes to configuration every " + interval
					+ " seconds.");

			this.configChangeListenerThread = new ConfigChangeListenerThread(this.resourceType, propsSrc,
					this.overrideProperties, this, this.bundlesHandler, interval);
			configChangeListenerThread.start();
		}

		if (this.bundlesHandler != null && jawrConfig.getUseSmartBundling()) {

			this.watcher = new ResourceWatcher(this.bundlesHandler, this.rsReaderHandler);
			this.bundlesHandler.setResourceWatcher(watcher);
			try {
				this.watcher.initPathToResourceBundleMap(this.bundlesHandler.getGlobalBundles());
				this.watcher.initPathToResourceBundleMap(this.bundlesHandler.getContextBundles());
			} catch (IOException e) {
				throw new BundlingProcessException("Impossible to initialize Jawr Resource Watcher", e);
			}

			this.watcher.start();
		}

		if (LOGGER.isInfoEnabled()) {
			long totaltime = System.currentTimeMillis() - initialTime;
			LOGGER.info("Init method successful. jawr started in " + (totaltime / 1000) + " seconds....");
		}

		// Reset ThreadLocalJawrContext
		ThreadLocalJawrContext.reset();
	}