Browse Source

test flow device_code; consent

pull/4/head
shengzhaoli.shengz 1 year ago
parent
commit
919b17ba61
  1. 30
      src/main/java/com/monkeyk/sos/web/controller/AuthorizationConsentController.java
  2. 10
      src/main/resources/templates/consent.html

30
src/main/java/com/monkeyk/sos/web/controller/AuthorizationConsentController.java

@ -120,6 +120,18 @@ public class AuthorizationConsentController {
OidcScopes.PROFILE,
"This application will be able to read your profile information."
);
SCOPE_DESCRIPTIONS.put(
OidcScopes.EMAIL,
"This application will be able to read your email information."
);
SCOPE_DESCRIPTIONS.put(
OidcScopes.PHONE,
"This application will be able to read your phone information."
);
SCOPE_DESCRIPTIONS.put(
OidcScopes.ADDRESS,
"This application will be able to read your address information."
);
SCOPE_DESCRIPTIONS.put(
"message.read",
"This application will be able to read your message."
@ -141,6 +153,24 @@ public class AuthorizationConsentController {
this.scope = scope;
this.description = SCOPE_DESCRIPTIONS.getOrDefault(scope, DEFAULT_DESCRIPTION);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ScopeWithDescription that = (ScopeWithDescription) o;
return Objects.equals(scope, that.scope) && Objects.equals(description, that.description);
}
@Override
public int hashCode() {
return Objects.hash(scope, description);
}
}
}

10
src/main/resources/templates/consent.html

@ -5,12 +5,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>授权确认 - Spring Security&OAuth2.1</title>
<link rel="stylesheet" href="../static/bootstrap.min.css" th:href="@{/bootstrap.min.css}"/>
<script>
function cancelConsent() {
document.consent_form.reset();
document.consent_form.submit();
}
</script>
</head>
<body>
<div class="container">
@ -84,9 +78,9 @@
</button>
</div>
<div class="pt-3">
<button class="btn btn-link regular" type="button" id="cancel-consent" onclick="cancelConsent();">
<a class="btn btn-link regular" type="button" id="cancel-consent" onclick="history.back()">
Cancel
</button>
</a>
</div>
</form>
</div>

Loading…
Cancel
Save