Skip to content

Commit

Permalink
Update readme.md (#1636)
Browse files Browse the repository at this point in the history
* Update readme.md

* Update readme.md

* allow tenant to use public-scope

* allow tenant to use public-scope
  • Loading branch information
Haaroon authored Jun 4, 2024
1 parent 66b125e commit e42c74a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions raphtory-graphql/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ To enable authentication for the Raphtory-GraphQL server, you need to set up a `

5. **Set the Authority:**
- The `AUTHORITY` is typically in the format `https://login.microsoftonline.com/{TENANT_ID}`.

6. **Set the redirection URLS**
- Next you need to set the redirection URLs, Go to the Manage > Authentication and add the following, note you can change `http://localhost:1736` to a custom url if it is different
- "http://localhost:1736/"
- "http://localhost:1736/auth/callback"

7. **Set some permissions**
- Next we need to set some permissions onto the application so we able to use it.
- Go to Manage > Expose an API > Add a scope
- Set Scope NAme, Admin Consent Display name and Admin consent description to "public-scope" without quotes
- Set Who can consent? To Admin and Users,
- Click Add Scope
- Go to Manage > API Permissions. Then remove any existing permissions include the Microsoft Graph default permissions.
- Now the next step, if you just made the scope it may not show up and can take a while, wait 10-20 mins, refresh the page and return if you do not see the app
- Click Add a permission > Under APIs my organization uses > type in the name of your app, and click on the name, you will see it comes up with a "Select permissions" page, select the "public-scope" permission we just made and finally click "Add permissions" on the bottom of the page

#### Example .env File

Expand Down
3 changes: 2 additions & 1 deletion raphtory-graphql/src/azure_auth/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub struct AppState {
pub async fn login(data: Data<&AppState>, jar: &CookieJar) -> Redirect {
let session_id = uuid::Uuid::new_v4().to_string();
let (pkce_challenge, pkce_verifier) = PkceCodeChallenge::new_random_sha256();
let client_id_str = env::var("CLIENT_ID").expect("CLIENT_ID not set");
let (authorize_url, csrf_state) = data
.oauth_client
.authorize_url(CsrfToken::new_random)
Expand All @@ -65,7 +66,7 @@ pub async fn login(data: Data<&AppState>, jar: &CookieJar) -> Redirect {
.add_scope(Scope::new("email".to_string()))
.add_scope(Scope::new("offline_access".to_string()))
.add_scope(Scope::new(
"a10e734e-cb36-46ca-bbfd-c298e15b6327/public-scope".to_string(),
format!("{}/public-scope", client_id_str).to_string(),
))
.url();

Expand Down

0 comments on commit e42c74a

Please sign in to comment.