Skip to content

Best way to programmatically determine if authenticated #1654

Answered by sbwalker
curelom asked this question in Q&A
Discussion options

You must be logged in to vote

Oqtane does not rely solely on authentication for security - it also requires users to be members of roles (ie. authorization). The best way to determine if the user is authenticated is to utilize the Oqtane,Security.UserSecurity.IsAuthorized() method. All authenticated users are members of the Registered Users role:

UserSecurity.IsAuthorized(PageState.User, RoleNames.Registered)

The Page.User.IsAuthenticated property is currently only populated during login to communicate status between the server and client. An enhancement could be added so that this property is also populated by the SiteRouter. This would make the behavior of this property more intuitive and useful. However it would s…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@curelom
Comment options

Comment options

You must be logged in to vote
2 replies
@curelom
Comment options

@hishamco
Comment options

Comment options

You must be logged in to vote
1 reply
@sbwalker
Comment options

Answer selected by curelom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants