ms-identity-python-flask-webapp-call-graph - identity_context_data 中的各种属性或方法是啥

Posted

技术标签:

【中文标题】ms-identity-python-flask-webapp-call-graph - identity_context_data 中的各种属性或方法是啥【英文标题】:ms-identity-python-flask-webapp-call-graph - What are the various properties or methods in identity_context_datams-identity-python-flask-webapp-call-graph - identity_context_data 中的各种属性或方法是什么 【发布时间】:2021-08-16 10:08:01 【问题描述】:

ms-identity-python-flask-webapp-call-graph - identity_context_data 中的各种属性或方法是什么(我看到 username 和 authenticated )。我如何使用此模块获取用户组

【问题讨论】:

【参考方案1】:
@property
def authenticated(self) -> bool:
    return self._authenticated

@authenticated.setter
def authenticated(self, value: bool) -> None:
    self._authenticated = value
    self.has_changed = True

@property
def username(self) -> str:
    return self._username

@username.setter
def username(self, value: str) -> None:
    self._username = value
    self.has_changed = True

@property
def token_cache(self) -> str:
    cache = SerializableTokenCache()
    if self._token_cache:
        cache.deserialize(self._token_cache)
    return cache

@token_cache.setter
def token_cache(self, value: SerializableTokenCache) -> None:
    if value.has_state_changed:
        self._token_cache = value.serialize()
        self.has_changed = True

@property
def state(self) -> str:
    return self._state

@state.setter
def state(self, value: str) -> None:
    self._state = value
    self.has_changed = True

@property
def nonce(self) -> str:
    return self._nonce

@nonce.setter
def nonce(self, value: str) -> None:
    self._nonce = value
    self.has_changed = True

# TODO: talk to MSIDWEB team
# or browse the code about how to implement the following:
@property
def last_used_b2c_policy(self) -> str:
    if len(self._last_used_b2c_policy):
        return self._last_used_b2c_policy.pop()
    return None

@last_used_b2c_policy.setter
def last_used_b2c_policy(self, value: str) -> None:
    self._last_used_b2c_policy = [value]
    self.has_changed = True

@property
def post_sign_in_url(self) -> str:
    return self._post_sign_in_url

@post_sign_in_url.setter
def post_sign_in_url(self, value: str) -> None:
    self._post_sign_in_url = value
    self.has_changed = True

ms_identity_web/context.py

【讨论】:

这段代码有什么作用?阅读How to Answer和edit你的答案。 嗨@padaleiana,这段代码是 IdentityContextData 类的一半......你可以在这里看到“identity_context_data”中可用的所有方法:)

以上是关于ms-identity-python-flask-webapp-call-graph - identity_context_data 中的各种属性或方法是啥的主要内容,如果未能解决你的问题,请参考以下文章