ASP.NET Core – Can I authorize Azure AD Users within my app without accessing the Azure AD?

Let me preface this by saying I’m extremely new to ASP.Net.

I have developed a basic app displaying company data (by department), and providing CRUD functionality for specific users. Obviously this means an Authorization attribute is required, as users shouldn’t be able to view data of other departments, and only department managers can create, update and delete records.

The app uses Azure AD Authentication. However, I have no access to the Azure AD of our company. Therefore, I’m not able to register my app and assign Roles to users. Instead, is there any way to accomplish this “within my app”, i.e. through code? Something like:

bool isAuthorized (string user) {
    if (user.Equals("<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6c191f091e2c0f03011c0d0215420f0301">[email protected]</a>") {
        return true;
    }
    else {
        return false;
    }
}

All the guides so far I’ve gone through either assume you have access to the Azure AD, or manage the user database yourself, so I’ve had no luck with them.

I will request access to the Azure AD if I have to, I just want to make sure there’s no other way of accomplishing this.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

For an app to authenticate a user against Azure AD, it needs an app registration that gives it its client id.

Purely technically speaking you could use the client id of another app etc., but that would be limited in its scenarios and a really bad practice!


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x