Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KEYCLOAK-2061 Add switches to enable/disable grant types for clients
- Loading branch information
Showing
24 changed files
with
348 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...update/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update1_7_0.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.keycloak.connections.mongo.updater.impl.updates; | ||
|
||
import com.mongodb.BasicDBObject; | ||
import com.mongodb.DBCollection; | ||
import com.mongodb.DBCursor; | ||
import org.keycloak.models.KeycloakSession; | ||
|
||
/** | ||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a> | ||
*/ | ||
public class Update1_7_0 extends Update { | ||
|
||
@Override | ||
public String getId() { | ||
return "1.7.0"; | ||
} | ||
|
||
@Override | ||
public void update(KeycloakSession session) throws ClassNotFoundException { | ||
DBCollection clients = db.getCollection("clients"); | ||
DBCursor clientsCursor = clients.find(); | ||
|
||
try { | ||
while (clientsCursor.hasNext()) { | ||
BasicDBObject client = (BasicDBObject) clientsCursor.next(); | ||
|
||
boolean directGrantsOnly = client.getBoolean("directGrantsOnly", false); | ||
client.append("standardFlowEnabled", !directGrantsOnly); | ||
client.append("implicitFlowEnabled", false); | ||
client.append("directAccessGrantsEnabled", true); | ||
client.removeField("directGrantsOnly"); | ||
|
||
clients.save(client); | ||
} | ||
} finally { | ||
clientsCursor.close(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.