Package org.ejbca.core.model.authorization

Examples of org.ejbca.core.model.authorization.AuthorizationDeniedException


    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    @Override
    public void setArchivedStatus(Admin admin, String fingerprint) throws AuthorizationDeniedException {
      if (admin.getAdminType() != Admin.TYPE_INTERNALUSER) {
        throw new AuthorizationDeniedException("Unauthorized");
      }
      CertificateData rev = CertificateData.findByFingerprint(entityManager, fingerprint);
      if (rev != null) {
        rev.setStatus(SecConst.CERT_ARCHIVED);
        if (log.isDebugEnabled()) {
View Full Code Here


           
            if(!authorizationSession.isAuthorizedNoLog(admin, AccessRulesConstants.REGULAR_RENEWCA)) {
                Authorizer.throwAuthorizationException(admin, AccessRulesConstants.REGULAR_RENEWCA, null);
            }
            if (!authorizedToCA(admin, caid)) {
                throw new AuthorizationDeniedException("Not authorized to CA");
            }
        } catch (AuthorizationDeniedException e) {
            String msg = intres.getLocalizedMessage("caadmin.notauthorizedtocertreq", Integer.valueOf(caid));
            logSession.log(admin, caid, LogConstants.MODULE_CA, new java.util.Date(), null, null, LogConstants.EVENT_ERROR_NOTAUTHORIZEDTORESOURCE, msg, e);
            throw new AuthorizationDeniedException(msg);
        }

        // Get CA info.
        CAData cadata = null;
        try {
View Full Code Here

    public byte[] signRequest(Admin admin, int caid, byte[] request, boolean usepreviouskey, boolean createlinkcert) throws AuthorizationDeniedException,
            CADoesntExistsException, CATokenOfflineException {
       if(!authorizationSession.isAuthorizedNoLog(admin, "/super_administrator")) {
            String msg = intres.getLocalizedMessage("caadmin.notauthorizedtocertreq", Integer.valueOf(caid));
            logSession.log(admin, caid, LogConstants.MODULE_CA, new java.util.Date(), null, null, LogConstants.EVENT_ERROR_NOTAUTHORIZEDTORESOURCE, msg);
            throw new AuthorizationDeniedException(msg);
        }
        byte[] returnval = null;
        String caname = "" + caid;
        CAData signedbydata = CAData.findByIdOrThrow(entityManager, Integer.valueOf(caid));
        try {
View Full Code Here

        try {
            if(!authorizationSession.isAuthorizedNoLog(admin, AccessRulesConstants.REGULAR_RENEWCA)) {
                Authorizer.throwAuthorizationException(admin, AccessRulesConstants.REGULAR_RENEWCA, null);
            }
            if (!authorizedToCA(admin, caid)) {
                throw new AuthorizationDeniedException("Not authorized to CA");
            }
        } catch (AuthorizationDeniedException e) {
            String msg = intres.getLocalizedMessage("caadmin.notauthorizedtocertresp", Integer.valueOf(caid));
            logSession.log(admin, caid, LogConstants.MODULE_CA, new java.util.Date(), null, null, LogConstants.EVENT_ERROR_NOTAUTHORIZEDTORESOURCE, msg, e);
            throw new AuthorizationDeniedException(msg);
        }

        // Get CA info.
        CAData cadata = CAData.findById(entityManager, Integer.valueOf(caid));
        if (cadata == null) {
View Full Code Here

        // check authorization
        if(!authorizationSession.isAuthorizedNoLog(admin, "/super_administrator")) {
            String msg = intres.getLocalizedMessage("caadmin.notauthorizedtocertresp", cainfo.getName());
            logSession.log(admin, admin.getCaId(), LogConstants.MODULE_CA, new java.util.Date(), null, null, LogConstants.EVENT_ERROR_NOTAUTHORIZEDTORESOURCE,
                    msg);
            throw new AuthorizationDeniedException(msg);
        }

        // Check that CA doesn't already exists
        CAData oldcadata = null;
        int caid = cainfo.getCAId();
View Full Code Here

            CADoesntExistsException, UnsupportedEncodingException, IllegalKeyStoreException {
        // check authorization
        if(!authorizationSession.isAuthorizedNoLog(admin, "/super_administrator")) {
            String msg = intres.getLocalizedMessage("caadmin.notauthorizedtorenew", Integer.valueOf(caid));
            logSession.log(admin, caid, LogConstants.MODULE_CA, new java.util.Date(), null, null, LogConstants.EVENT_ERROR_NOTAUTHORIZEDTORESOURCE, msg);
            throw new AuthorizationDeniedException(msg);
        }

        // Get CA info.
        CAData cadata = CAData.findByIdOrThrow(entityManager, Integer.valueOf(caid));
        CA ca = cadata.getCA();
View Full Code Here

        try {
            if(!authorizationSession.isAuthorizedNoLog(admin, AccessRulesConstants.REGULAR_RENEWCA)) {
                Authorizer.throwAuthorizationException(admin, AccessRulesConstants.REGULAR_RENEWCA, null);
            }
            if (!authorizedToCA(admin, caid)) {
                throw new AuthorizationDeniedException("Not authorized to CA");
            }
        } catch (AuthorizationDeniedException e) {
            String msg = intres.getLocalizedMessage("caadmin.notauthorizedtorenew", Integer.valueOf(caid));
            logSession.log(admin, caid, LogConstants.MODULE_CA, new java.util.Date(), null, null, LogConstants.EVENT_ERROR_NOTAUTHORIZEDTORESOURCE, msg, e);
            throw new AuthorizationDeniedException(msg);
        }

        // Get CA info.
        CAData cadata = null;
        try {
View Full Code Here

    public void revokeCA(Admin admin, int caid, int reason) throws CADoesntExistsException, AuthorizationDeniedException {
        // check authorization
        if(!authorizationSession.isAuthorizedNoLog(admin, "/super_administrator")) {
            String msg = intres.getLocalizedMessage("caadmin.notauthorizedtorevoke", Integer.valueOf(caid));
            logSession.log(admin, caid, LogConstants.MODULE_CA, new java.util.Date(), null, null, LogConstants.EVENT_ERROR_NOTAUTHORIZEDTORESOURCE, msg);
            throw new AuthorizationDeniedException(msg);
        }
        // Get CA info.
        CAData cadata = CAData.findByIdOrThrow(entityManager, Integer.valueOf(caid));
        String issuerdn = cadata.getSubjectDN();
        try {
View Full Code Here

            CATokenAuthenticationFailedException, CATokenOfflineException, ApprovalException, WaitingForApprovalException {
        // Authorize
        if(!authorizationSession.isAuthorizedNoLog(admin, AccessRulesConstants.REGULAR_ACTIVATECA)) {
            String msg = intres.getLocalizedMessage("caadmin.notauthorizedtoactivatetoken", Integer.valueOf(caid));
            logSession.log(admin, caid, LogConstants.MODULE_CA, new java.util.Date(), null, null, LogConstants.EVENT_ERROR_NOTAUTHORIZEDTORESOURCE, msg);
            throw new AuthorizationDeniedException(msg);
        }

        // Check if approvals is required.
        CAInfo cainfo = getCAInfo(admin, caid);
        if (cainfo == null) {
View Full Code Here

    public void deactivateCAToken(Admin admin, int caid) throws AuthorizationDeniedException, EjbcaException {
        // Authorize
        if(!authorizationSession.isAuthorizedNoLog(admin, AccessRulesConstants.REGULAR_ACTIVATECA)) {
            String msg = intres.getLocalizedMessage("caadmin.notauthorizedtodeactivatetoken", Integer.valueOf(caid));
            logSession.log(admin, caid, LogConstants.MODULE_CA, new java.util.Date(), null, null, LogConstants.EVENT_ERROR_NOTAUTHORIZEDTORESOURCE, msg);
            throw new AuthorizationDeniedException(msg);
        }
        if (caid >= 0 && caid <= CAInfo.SPECIALCAIDBORDER) {
          // This should never happen.
          String msg = intres.getLocalizedMessage("caadmin.errordeactivatetoken", Integer.valueOf(caid));
          logSession.log(admin, caid, LogConstants.MODULE_CA, new java.util.Date(), null, null, LogConstants.EVENT_ERROR_CAEDITED, msg);
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.authorization.AuthorizationDeniedException

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.