如何在WPF应用程序中存储Web Api身份验证令牌?

时间:2016-10-20 06:24:30

标签: wpf asp.net-web-api oauth authorization restsharp

我有一个Web Api的WPF客户端,它在身份验证时发出令牌。我在客户端上没有数据库,也不知道如何存储该令牌。它应该安全存储,但在哪里和如何。没有加密,内存和磁盘非常不安全。

最后,我可以将它存储在主窗口视图模型的SecureString中。

1 个答案:

答案 0 :(得分:0)

最后,确实最好将其存储为- (void)viewDidLoad { [super viewDidLoad]; labelTouch.userInteractionEnabled = YES; [self labelLongPressed:labelTouch];} - (void)labelLongPressed:(UILabel *)label{ UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]; longPress.minimumPressDuration = 2; //seconds longPress.delegate = self; [label addGestureRecognizer:longPress];} -(void) handleLongPress : (UITapGestureRecognizer *)sender{ UIButton *button = (UIButton *)sender.view; NSLog(@"longpress");} 类中的SecureString,尽可能接近它所需的位置。我甚至可能只在请求执行时将其解码为自定义ApiClient中的部分请求,这意味着它只会在API的授权提供程序中容易受到攻击,这可能非常紧张