Ignore:
Timestamp:
09/04/11 21:44:37 (9 months ago)
Author:
delmitz
Branch:
default
Convert:
svn:7c3792e6-d75b-4784-96a6-b298f655ee64/trunk@2723
Message:

added otp option.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kraken-dom/src/main/java/org/krakenapps/dom/msgbus/AdminPlugin.java

    r282 r289  
    9595 
    9696                Admin admin = toAdmin(req); 
     97                if (admin.isUseOtp()) 
     98                        admin.setOtpSeed(createOtpSeed()); 
    9799                admin.setUser(user); 
    98100                adminApi.createAdmin(req.getOrgId(), req.getAdminId(), admin); 
     
    143145        } 
    144146 
     147        @MsgbusMethod 
     148        public void updateOtpSeed(Request req, Response resp) { 
     149                if (req.getAdminId() == null) 
     150                        throw new SecurityException("not admin"); 
     151 
     152                Admin admin = adminApi.getAdmin(req.getOrgId(), req.getAdminId()); 
     153                if (admin == null) 
     154                        throw new IllegalArgumentException("admin not found"); 
     155 
     156                if (admin.isUseOtp()) 
     157                        admin.setOtpSeed(createOtpSeed()); 
     158                else 
     159                        admin.setOtpSeed(null); 
     160 
     161                adminApi.updateAdmin(req.getOrgId(), req.getAdminId(), admin); 
     162                resp.put("otp_seed", admin.getOtpSeed()); 
     163        } 
     164 
    145165        private Admin toAdmin(Request req) throws RoleNotFoundException { 
    146166                Admin admin = new Admin(); 
     
    156176                if (profile == null) 
    157177                        throw new ProgramProfileNotFoundException(profileId); 
    158                  
     178 
    159179                admin.setProgramProfile(profile); 
    160180                admin.setUseLoginLock(req.getBoolean("use_login_lock")); 
     
    164184                admin.setIdleTimeout(req.getInteger("idle_timeout")); 
    165185                admin.setEnabled(req.getBoolean("is_enabled")); 
     186                admin.setUseOtp(req.getBoolean("use_otp")); 
     187                if (admin.isUseOtp()) 
     188                        admin.setOtpSeed(null); 
    166189 
    167190                admin.validate(); 
    168191                return admin; 
    169192        } 
     193 
     194        private String createOtpSeed() { 
     195                return null; 
     196        } 
    170197} 
Note: See TracChangeset for help on using the changeset viewer.