📄 edithardtokenprofilejsphelper.java
字号:
String oldhardtokenprofilename = request.getParameter(SELECT_HARDTOKENPROFILES); if(oldhardtokenprofilename != null && newhardtokenprofilename != null){ if(!newhardtokenprofilename.trim().equals("") && !oldhardtokenprofilename.trim().equals("")){ try{ handler.renameHardTokenProfile(oldhardtokenprofilename.trim(),newhardtokenprofilename.trim()); }catch( HardTokenProfileExistsException e){ hardtokenprofileexists=true; } } } includefile=PAGE_HARDTOKENPROFILES; } if( request.getParameter(BUTTON_ADD_HARDTOKENPROFILES) != null){ // Add profile and display profilespage. profile = request.getParameter(TEXTFIELD_HARDTOKENPROFILESNAME); if(profile != null){ if(!profile.trim().equals("")){ try{ if(!handler.addHardTokenProfile(profile.trim(), new SwedishEIDProfile())){ profilemalformed = true; } }catch( HardTokenProfileExistsException e){ hardtokenprofileexists=true; } } } includefile=PAGE_HARDTOKENPROFILES; } if( request.getParameter(BUTTON_CLONE_HARDTOKENPROFILES) != null){ // clone profile and display profilespage. String newhardtokenprofilename = request.getParameter(TEXTFIELD_HARDTOKENPROFILESNAME); String oldhardtokenprofilename = request.getParameter(SELECT_HARDTOKENPROFILES); if(oldhardtokenprofilename != null && newhardtokenprofilename != null){ if(!newhardtokenprofilename.trim().equals("") && !oldhardtokenprofilename.trim().equals("")){ try{ handler.cloneHardTokenProfile(oldhardtokenprofilename.trim(),newhardtokenprofilename.trim()); }catch(HardTokenProfileExistsException e){ hardtokenprofileexists=true; } } } includefile=PAGE_HARDTOKENPROFILES; } } if( action.equals(ACTION_EDIT_HARDTOKENPROFILE)){ // Display edit access rules page. profile = request.getParameter(HIDDEN_HARDTOKENPROFILENAME); if(profile != null){ if(!profile.trim().equals("")){ if(request.getParameter(BUTTON_SAVE) != null || request.getParameter(BUTTON_UPLOADENVELOPETEMP) != null || request.getParameter(BUTTON_UPLOADVISUALTEMP) != null || request.getParameter(BUTTON_UPLOADRECEIPTTEMP) != null || request.getParameter(BUTTON_UPLOADADRESSLABELTEMP) != null ){ if(profiledata == null){ String tokentype = request.getParameter(HIDDEN_HARDTOKENTYPE); if(tokentype.equals(TYPE_SWEDISHEID)) profiledata = new SwedishEIDProfile(); if(tokentype.equals(TYPE_ENCHANCEDEID)) profiledata = new EnhancedEIDProfile(); if(tokentype.equals(TYPE_TURKISHEID)) profiledata = new TurkishEIDProfile(); } // Save changes. // General settings String value = request.getParameter(TEXTFIELD_SNPREFIX); if(value != null){ value = value.trim(); profiledata.setHardTokenSNPrefix(value); } value = request.getParameter(CHECKBOX_EREASBLE); if(value != null){ profiledata.setEreasableToken(value.equals(CHECKBOX_VALUE)); }else profiledata.setEreasableToken(false); value = request.getParameter(SELECT_NUMOFTOKENCOPIES); if(value != null){ profiledata.setNumberOfCopies(Integer.parseInt(value)); } value = request.getParameter(CHECKBOX_USEIDENTICALPINS); if(value != null){ profiledata.setGenerateIdenticalPINForCopies(value.equals(CHECKBOX_VALUE)); }else profiledata.setGenerateIdenticalPINForCopies(false); if(profiledata instanceof HardTokenProfileWithPINEnvelope){ value = request.getParameter(SELECT_ENVELOPETYPE); if(value != null) ((HardTokenProfileWithPINEnvelope) profiledata).setPINEnvelopeType(Integer.parseInt(value)); value = request.getParameter(SELECT_NUMOFENVELOPECOPIES); if(value != null) ((HardTokenProfileWithPINEnvelope) profiledata).setNumberOfPINEnvelopeCopies(Integer.parseInt(value)); value = request.getParameter(TEXTFIELD_VISUALVALIDITY); if(value != null) ((HardTokenProfileWithPINEnvelope) profiledata).setVisualValidity(Integer.parseInt(value)); } if(profiledata instanceof HardTokenProfileWithVisualLayout){ HardTokenProfileWithVisualLayout visprof = (HardTokenProfileWithVisualLayout) profiledata; value = request.getParameter(SELECT_VISUALLAYOUTTYPE); if(value != null) visprof.setVisualLayoutType(Integer.parseInt(value)); } if(profiledata instanceof HardTokenProfileWithReceipt){ value = request.getParameter(SELECT_RECEIPTTYPE); if(value != null) ((HardTokenProfileWithReceipt) profiledata).setReceiptType(Integer.parseInt(value)); value = request.getParameter(SELECT_NUMOFRECEIPTCOPIES); if(value != null) ((HardTokenProfileWithReceipt) profiledata).setNumberOfReceiptCopies(Integer.parseInt(value)); } if(profiledata instanceof HardTokenProfileWithAdressLabel){ value = request.getParameter(SELECT_ADRESSLABELTYPE); if(value != null) ((HardTokenProfileWithAdressLabel) profiledata).setAdressLabelType(Integer.parseInt(value)); value = request.getParameter(SELECT_NUMOFADRESSLABELCOPIES); if(value != null) ((HardTokenProfileWithAdressLabel) profiledata).setNumberOfAdressLabelCopies(Integer.parseInt(value)); } if(profiledata instanceof SwedishEIDProfile){ SwedishEIDProfile sweprof = (SwedishEIDProfile) profiledata; value = request.getParameter(SELECT_MINKEYLENGTH); if(value!= null){ int val = Integer.parseInt(value); sweprof.setMinimumKeyLength(SwedishEIDProfile.CERTUSAGE_SIGN, val); sweprof.setMinimumKeyLength(SwedishEIDProfile.CERTUSAGE_AUTHENC, val); sweprof.setKeyType(SwedishEIDProfile.CERTUSAGE_SIGN, EIDProfile.KEYTYPE_RSA); sweprof.setKeyType(SwedishEIDProfile.CERTUSAGE_AUTHENC, EIDProfile.KEYTYPE_RSA); } value = request.getParameter(CHECKBOX_CERTWRITABLE); if(value != null){ sweprof.setCertWritable(SwedishEIDProfile.CERTUSAGE_SIGN, value.equals(CHECKBOX_VALUE)); sweprof.setCertWritable(SwedishEIDProfile.CERTUSAGE_AUTHENC, value.equals(CHECKBOX_VALUE)); }else{ sweprof.setCertWritable(SwedishEIDProfile.CERTUSAGE_SIGN, false); sweprof.setCertWritable(SwedishEIDProfile.CERTUSAGE_AUTHENC, false); } value = request.getParameter(SELECT_CERTIFICATEPROFILE + "0"); if(value!= null) sweprof.setCertificateProfileId(SwedishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value)); value = request.getParameter(SELECT_CA + "0"); if(value!= null) sweprof.setCAId(SwedishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value)); value = request.getParameter(SELECT_PINTYPE + "0"); if(value!= null) sweprof.setPINType(SwedishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value)); value = request.getParameter(SELECT_MINPINLENGTH + "0"); if(value!= null) sweprof.setMinimumPINLength(SwedishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value)); value = request.getParameter(SELECT_CERTIFICATEPROFILE + "1"); if(value!= null) sweprof.setCertificateProfileId(SwedishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value)); value = request.getParameter(SELECT_CA + "1"); if(value!= null) sweprof.setCAId(SwedishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value)); value = request.getParameter(SELECT_PINTYPE + "1"); if(value!= null) sweprof.setPINType(SwedishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value)); value = request.getParameter(SELECT_MINPINLENGTH + "1"); if(value!= null) sweprof.setMinimumPINLength(SwedishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value)); } if(profiledata instanceof TurkishEIDProfile){ TurkishEIDProfile turkprof = (TurkishEIDProfile) profiledata; value = request.getParameter(SELECT_MINKEYLENGTH); if(value!= null){ int val = Integer.parseInt(value); turkprof.setMinimumKeyLength(TurkishEIDProfile.CERTUSAGE_SIGN, val); turkprof.setMinimumKeyLength(TurkishEIDProfile.CERTUSAGE_AUTHENC, val); turkprof.setKeyType(TurkishEIDProfile.CERTUSAGE_SIGN, EIDProfile.KEYTYPE_RSA); turkprof.setKeyType(TurkishEIDProfile.CERTUSAGE_AUTHENC, EIDProfile.KEYTYPE_RSA); } value = request.getParameter(CHECKBOX_CERTWRITABLE); if(value != null){ turkprof.setCertWritable(TurkishEIDProfile.CERTUSAGE_SIGN, value.equals(CHECKBOX_VALUE)); turkprof.setCertWritable(TurkishEIDProfile.CERTUSAGE_AUTHENC, value.equals(CHECKBOX_VALUE)); }else{ turkprof.setCertWritable(TurkishEIDProfile.CERTUSAGE_SIGN, false); turkprof.setCertWritable(TurkishEIDProfile.CERTUSAGE_AUTHENC, false); } value = request.getParameter(SELECT_CERTIFICATEPROFILE + "0"); if(value!= null) turkprof.setCertificateProfileId(TurkishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value)); value = request.getParameter(SELECT_CA + "0"); if(value!= null) turkprof.setCAId(TurkishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value)); value = request.getParameter(SELECT_PINTYPE + "0"); if(value!= null) turkprof.setPINType(TurkishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value)); value = request.getParameter(SELECT_MINPINLENGTH + "0"); if(value!= null) turkprof.setMinimumPINLength(TurkishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value)); value = request.getParameter(SELECT_CERTIFICATEPROFILE + "1"); if(value!= null) turkprof.setCertificateProfileId(TurkishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value)); value = request.getParameter(SELECT_CA + "1"); if(value!= null) turkprof.setCAId(TurkishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value)); } if(profiledata instanceof EnhancedEIDProfile){ EnhancedEIDProfile enhprof = (EnhancedEIDProfile) profiledata; value = request.getParameter(SELECT_MINKEYLENGTH); if(value!= null){ int val = Integer.parseInt(value); enhprof.setMinimumKeyLength(EnhancedEIDProfile.CERTUSAGE_SIGN, val); enhprof.setMinimumKeyLength(EnhancedEIDProfile.CERTUSAGE_AUTH, val); enhprof.setMinimumKeyLength(EnhancedEIDProfile.CERTUSAGE_ENC, val); enhprof.setKeyType(EnhancedEIDProfile.CERTUSAGE_SIGN, EIDProfile.KEYTYPE_RSA); enhprof.setKeyType(EnhancedEIDProfile.CERTUSAGE_ENC, EIDProfile.KEYTYPE_RSA); enhprof.setKeyType(EnhancedEIDProfile.CERTUSAGE_ENC, EIDProfile.KEYTYPE_RSA); } value = request.getParameter(CHECKBOX_CERTWRITABLE); if(value != null){ enhprof.setCertWritable(EnhancedEIDProfile.CERTUSAGE_SIGN, value.equals(CHECKBOX_VALUE)); enhprof.setCertWritable(EnhancedEIDProfile.CERTUSAGE_AUTH, value.equals(CHECKBOX_VALUE));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -