Skip to content

obo, b2c samples#96

Merged
SomkaPe merged 3 commits intodevfrom
pesomka/obo-sample
Sep 18, 2019
Merged

obo, b2c samples#96
SomkaPe merged 3 commits intodevfrom
pesomka/obo-sample

Conversation

@SomkaPe
Copy link
Copy Markdown
Contributor

@SomkaPe SomkaPe commented Sep 13, 2019

No description provided.

Copy link
Copy Markdown
Contributor

@henrik-me henrik-me left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@SomkaPe SomkaPe changed the title obo sample obo, b2c sample Sep 17, 2019
@SomkaPe SomkaPe changed the title obo, b2c sample obo, b2c samples Sep 17, 2019
Copy link
Copy Markdown
Contributor

@sangonzal sangonzal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me. Added some suggestions. I think it could also benefit from some comments around the OBO part (stating that people have to run both apps for it to work) and Spring security(high level overview of what is happening)

}

@Autowired
AuthFilter authFilter;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should go to top of file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

AuthFilter authFilter;

@RequestMapping("/edit-profile")
public void callOboApi(HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws Throwable {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method should be removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will rename it

String result = restTemplate.exchange(authHelper.configuration.api, HttpMethod.GET,
entity, String.class).getBody();

return new Date() + result;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to return a Date() here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes , to show that shown result is different

import org.json.JSONArray;
import org.json.JSONObject;

class JSONHelper {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is not being used anywhere, can be deleted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


@Getter
@Setter
public class User {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not calling graph, so this can be deleted as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

"response_mode=form_post&" +
"redirect_uri=" + URLEncoder.encode(authHelper.getRedirectUri(), "UTF-8") +
"&client_id=" + authHelper.getClientId() +
//"&scope=" + URLEncoder.encode("openid offline_access profile", "UTF-8") +
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, will do

@Autowired
MsalAuthHelper msalAuthHelper;

@RequestMapping("/api")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe more descriptive name? Like callGraphMeEndpoint

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@jmprieur
Copy link
Copy Markdown

@SomkaPe SomkaPe merged commit 709a96c into dev Sep 18, 2019
Copy link
Copy Markdown

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
I left a question

@RequestMapping("/graph/users")
public ModelAndView getUsersFromGraph(ModelMap model, HttpServletRequest httpRequest) throws Throwable {
IAuthenticationResult result = authHelper.getAuthResultBySilentFlow(httpRequest);
IAuthenticationResult result = authHelper.getAuthResultBySilentFlow(httpRequest, "https://graph.microsoft.com/.default");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using .default won't allow for incremental consent. Is it ok?

@sangonzal sangonzal deleted the pesomka/obo-sample branch November 22, 2019 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants