public bool register(AuthClientDetails clientDetails) { // 客户端的名称和回调地址不能为空 if (!string.IsNullOrEmpty(clientDetails.getClientName()) && !string.IsNullOrEmpty(clientDetails.getRedirectUri())) { // 生成24位随机的clientId string clientId = EncryptUtils.getRandomStr1(24); AuthClientDetails savedClientDetails = authClientDetailsMapper.selectByClientId(clientId); //生成的clientId必须是唯一的 for (int i = 0; i < 10; i++) { if (savedClientDetails == null) { break; } else { clientId = EncryptUtils.getRandomStr1(24); savedClientDetails = authClientDetailsMapper.selectByClientId(clientId); } } // 生成32位随机的clientSecret string clientSecret = EncryptUtils.getRandomStr1(32); DateTime current = new DateTime(); HttpSessionState session = HttpContextUtils.getSession(); User user = (User)session[Constants.SESSION_USER]; // continuing... } }
public string createAccessToken(User user, AuthClientDetails savedClientDetails, string grantType, string scope, long expiresIn) { throw new NotImplementedException(); }