oauth client generates secret

This commit is contained in:
Bill Burke 2014-02-14 17:45:46 -05:00
parent e35c251440
commit b518fa2f4b
3 changed files with 10 additions and 2 deletions

View file

@ -9,7 +9,7 @@
<p><a href="customers/view.jsp">Customer Listing</a></p>
<p><a href="admin/admin.html">Customer Admin Interface</a></p>
<p><a href="admin/admin.jsp">Customer Admin Interface</a></p>
</body>
</html>

View file

@ -8,7 +8,7 @@
<h1>Product Portal</h1>
<p><a href="products/view.jsp">Product Listing</a></p>
<p><a href="admin/admin.html">Admin Interface</a></p>
<p><a href="admin/admin.jsp">Admin Interface</a></p>
</body>
</html>

View file

@ -34,10 +34,18 @@ public class OAuthClientManager {
this.realm = realm;
}
public UserCredentialModel generateSecret(RealmModel realm, OAuthClientModel app) {
UserCredentialModel secret = UserCredentialModel.generateSecret();
realm.updateCredential(app.getOAuthAgent(), secret);
return secret;
}
public OAuthClientModel create(String name) {
OAuthClientModel model = realm.addOAuthClient(name);
RoleModel role = realm.getRole(Constants.IDENTITY_REQUESTER_ROLE);
realm.grantRole(model.getOAuthAgent(), role);
generateSecret(realm, model);
return model;
}