Changeset 2225 for trunk/grails-app/services/api/ApiService.groovy
- Timestamp:
- Apr 25, 2012, 10:42:52 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/api/ApiService.groovy
r2224 r2225 25 25 // inject the module communication service 26 26 def moduleCommunicationService 27 28 // the shared secret used to validate api calls29 static final String API_SECRET = "th!s_sH0uld^Pr0bab7y_m0v3_t%_th3_uSeR_d0Ma!n_ins7ead!"30 27 31 28 // transactional … … 72 69 // disable validation check on development and ci 73 70 if (['development', 'ci'].contains(grails.util.GrailsUtil.environment)) { 74 return true71 // return true 75 72 } 76 73 … … 85 82 // generate the validation checksum 86 83 MessageDigest digest = MessageDigest.getInstance("MD5") 87 String validationSum = new BigInteger(1,digest.digest("${token.deviceToken}${token.sequence}${ API_SECRET}".getBytes())).toString(16).padLeft(32,"0")84 String validationSum = new BigInteger(1,digest.digest("${token.deviceToken}${token.sequence}${token.user.apiKey}".getBytes())).toString(16).padLeft(32,"0") 88 85 89 86 // check if the validation confirms
Note: See TracChangeset
for help on using the changeset viewer.